projects
/
profile
/
ivi
/
syslinux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0fa6cb3
)
fstat(): report files of unknown length as sockets
author
H. Peter Anvin
<hpa@zytor.com>
Sat, 23 Feb 2008 06:32:20 +0000
(22:32 -0800)
committer
H. Peter Anvin
<hpa@zytor.com>
Sat, 23 Feb 2008 06:32:20 +0000
(22:32 -0800)
com32/lib/sys/fstat.c
patch
|
blob
|
history
diff --git
a/com32/lib/sys/fstat.c
b/com32/lib/sys/fstat.c
index
3a42ab8
..
ef5e20d
100644
(file)
--- a/
com32/lib/sys/fstat.c
+++ b/
com32/lib/sys/fstat.c
@@
-45,8
+45,15
@@
int fstat(int fd, struct stat *buf)
}
if ( fp->iop->flags & __DEV_FILE ) {
- buf->st_mode = S_IFREG | 0444;
- buf->st_size = fp->i.length;
+ if ( fp->i.length == (uint32_t)-1 ) {
+ /* File of unknown length, report it as a socket
+ (it probably really is, anyway!) */
+ buf->st_mode = S_IFSOCK | 0444;
+ buf->st_size = 0;
+ } else {
+ buf->st_mode = S_IFREG | 0444;
+ buf->st_size = fp->i.length;
+ }
} else {
buf->st_mode = S_IFCHR | 0666;
buf->st_size = 0;