mirror of
https://git.musl-libc.org/git/musl
synced 2025-01-06 23:02:10 +03:00
fix pipe2 silently ignoring unknown flags on old kernels
kernels using the fallback have an inherent close-on-exec race condition and as such support for them is only best-effort anyway. however, ignoring potential new flags is still very bad behavior. instead, fail with EINVAL.
This commit is contained in:
parent
b1dfb734a4
commit
fb7fb5e4bd
@ -8,6 +8,7 @@ int pipe2(int fd[2], int flag)
|
||||
if (!flag) return pipe(fd);
|
||||
int ret = __syscall(SYS_pipe2, fd, flag);
|
||||
if (ret != -ENOSYS) return __syscall_ret(ret);
|
||||
if (flag & ~(O_CLOEXEC|O_NONBLOCK)) return __syscall_ret(-EINVAL);
|
||||
ret = pipe(fd);
|
||||
if (ret) return ret;
|
||||
if (flag & O_CLOEXEC) {
|
||||
|
Loading…
Reference in New Issue
Block a user