mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Fix kernel leaking ESPIPE in non-error cases.
This commit is contained in:
parent
933720e0b0
commit
73dc4a0feb
1 changed files with 2 additions and 0 deletions
|
@ -149,9 +149,11 @@ bool Descriptor::IsSeekable()
|
||||||
if ( !checked_seekable )
|
if ( !checked_seekable )
|
||||||
{
|
{
|
||||||
// TODO: Is this enough? Check that errno happens to be ESPIPE?
|
// TODO: Is this enough? Check that errno happens to be ESPIPE?
|
||||||
|
int saved_errno = errno;
|
||||||
ioctx_t ctx; SetupKernelIOCtx(&ctx);
|
ioctx_t ctx; SetupKernelIOCtx(&ctx);
|
||||||
seekable = 0 <= vnode->lseek(&ctx, SEEK_SET, 0) || S_ISDIR(vnode->type);
|
seekable = 0 <= vnode->lseek(&ctx, SEEK_SET, 0) || S_ISDIR(vnode->type);
|
||||||
checked_seekable = true;
|
checked_seekable = true;
|
||||||
|
errno = saved_errno;
|
||||||
}
|
}
|
||||||
return seekable;
|
return seekable;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue