diff --git a/lib/other/fdopen.c b/lib/other/fdopen.c index 9842fd941..3a72099e8 100755 --- a/lib/other/fdopen.c +++ b/lib/other/fdopen.c @@ -6,6 +6,7 @@ #include #include "../stdio/loc_incl.h" #include +#include FILE * fdopen(fd, mode) @@ -13,6 +14,7 @@ int fd; _CONST char *mode; { register int i; + struct stat st; FILE *stream; int flags = 0; @@ -47,6 +49,14 @@ _CONST char *mode; break; } + if ( fstat( fd, &st ) < 0 ) { + return (FILE *)NULL; + } + + if ( st.st_mode & S_IFIFO ) { + flags |= _IOFIFO; + } + if ((stream = (FILE *) malloc(sizeof(FILE))) == NULL) { return (FILE *)NULL; }