Also a change by Joren

This commit is contained in:
Ben Gras 2005-09-06 10:15:57 +00:00
parent d7c82dcec5
commit 9517eff5a4

View File

@ -6,6 +6,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "../stdio/loc_incl.h" #include "../stdio/loc_incl.h"
#include <stdio.h> #include <stdio.h>
#include <sys/stat.h>
FILE * FILE *
fdopen(fd, mode) fdopen(fd, mode)
@ -13,6 +14,7 @@ int fd;
_CONST char *mode; _CONST char *mode;
{ {
register int i; register int i;
struct stat st;
FILE *stream; FILE *stream;
int flags = 0; int flags = 0;
@ -47,6 +49,14 @@ _CONST char *mode;
break; break;
} }
if ( fstat( fd, &st ) < 0 ) {
return (FILE *)NULL;
}
if ( st.st_mode & S_IFIFO ) {
flags |= _IOFIFO;
}
if ((stream = (FILE *) malloc(sizeof(FILE))) == NULL) { if ((stream = (FILE *) malloc(sizeof(FILE))) == NULL) {
return (FILE *)NULL; return (FILE *)NULL;
} }