]> git.ipfire.org Git - thirdparty/systemd.git/commit
tree-wide: check POLLNVAL everywhere
authorLennart Poettering <lennart@poettering.net>
Tue, 9 Jun 2020 11:40:25 +0000 (13:40 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 10 Jun 2020 06:57:31 +0000 (08:57 +0200)
commitdad28bffd67692d6c22e0de98ddb0d217c034ec5
tree29b5ec4a723341c4a38636d8be4566dba5a38ec0
parent45204921be610be839482a037985fd5a5052f2dd
tree-wide: check POLLNVAL everywhere

poll() sets POLLNVAL inside of the poll structures if an invalid fd is
passed. So far we generally didn't check for that, thus not taking
notice of the error. Given that this specific kind of error is generally
indication of a programming error, and given that our code is embedded
into our projects via NSS or because people link against our library,
let's explicitly check for this and convert it to EBADF.

(I ran into a busy loop because of this missing check when some of my
test code accidentally closed an fd it shouldn't close, so this is a
real thing)
17 files changed:
src/basic/io-util.c
src/basic/socket-util.c
src/journal/journalctl.c
src/libsystemd/sd-bus/bus-socket.c
src/libsystemd/sd-bus/sd-bus.c
src/libsystemd/sd-daemon/sd-daemon.c
src/libsystemd/sd-netlink/sd-netlink.c
src/libudev/libudev-monitor.c
src/shared/ask-password-api.c
src/shared/barrier.c
src/shared/utmp-wtmp.c
src/shared/varlink.c
src/sleep/sleep.c
src/stdio-bridge/stdio-bridge.c
src/tty-ask-password-agent/tty-ask-password-agent.c
src/udev/udevadm-settle.c
src/userdb/userwork.c