diff options
Diffstat (limited to 'libio')
-rw-r--r-- | libio/fileops.c | 5 | ||||
-rw-r--r-- | libio/iofdopen.c | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/libio/fileops.c b/libio/fileops.c index a53f89f..dbea631 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -234,7 +234,10 @@ _IO_file_open (fp, filename, posix_mode, prot, read_write, is32not64) if (read_write & _IO_IS_APPENDING) if (_IO_SEEKOFF (fp, (_IO_off64_t)0, _IO_seek_end, _IOS_INPUT|_IOS_OUTPUT) == _IO_pos_BAD && errno != ESPIPE) - return NULL; + { + close (fdesc); + return NULL; + } INTUSE(_IO_link_in) ((struct _IO_FILE_plus *) fp); return fp; } diff --git a/libio/iofdopen.c b/libio/iofdopen.c index a4ac03f..ee8caa3 100644 --- a/libio/iofdopen.c +++ b/libio/iofdopen.c @@ -132,6 +132,7 @@ _IO_new_fdopen (fd, mode) #endif if (INTUSE(_IO_file_attach) ((_IO_FILE *) &new_f->fp, fd) == NULL) { + INTUSE(_IO_setb) (&new_f->fp, NULL, NULL, 0); INTUSE(_IO_un_link) (&new_f->fp); free (new_f); return NULL; |