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:
parent
fd5b40de26
commit
31c310036c
1 changed files with 2 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue