From 9517eff5a4d67693843a1d1002b24ea6d71605e4 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Tue, 6 Sep 2005 10:15:57 +0000 Subject: [PATCH] Also a change by Joren --- lib/other/fdopen.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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; } -- 2.44.0