From: Ben Gras Date: Tue, 6 Sep 2005 10:15:57 +0000 (+0000) Subject: Also a change by Joren X-Git-Tag: v3.1.0~178 X-Git-Url: http://zhaoyanbai.com/repos/man.rndc.html?a=commitdiff_plain;h=9517eff5a4d67693843a1d1002b24ea6d71605e4;p=minix.git Also a change by Joren --- 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; }