1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Fix lseek changing errno in fdio_install_fd when no real error occurs.

This commit is contained in:
Jonas 'Sortie' Termansen 2014-02-15 20:57:49 +01:00
parent fd5b40de26
commit 31c310036c

View file

@ -207,8 +207,10 @@ extern "C" int fdio_install_fd(FILE* fp, int fd, const char* mode)
fp->error_func = fdio_error;
fp->fileno_func = fdio_fileno;
fp->close_func = fdio_close;
int preserved_errno = errno;
if ( lseek(fd, 0, SEEK_CUR) < 0 && errno == ESPIPE )
fp->flags |= _FILE_STREAM;
errno = preserved_errno;
return 1;
}