diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2013-11-28 14:51:40 +0100 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2013-11-28 15:16:49 +0100 |
commit | d1107170f9e0fa2cb6e8d18586a003f0d96abfc3 (patch) | |
tree | 08ba69530e7b181afa74e81076e792f06befc138 /units/suspend.target | |
parent | 5fd38859b30b95008e483109578c7fef2b5072f3 (diff) |
logind: ignore failing close() on session-devices
Unfortunately, close() on a revoked/removed character-device fails with
ENODEV. I tried tracking this down in the kernel, but couldn't figure out
were exactly it comes from. However, can be easily reproduced with:
fd = open("/dev/input/event0", O_RDWR);
ioctl(fd, EVIOCREVOKE, 0);
r = close(fd);
A second close on @fd would return EBADF so the close is actually valid.
We simply ignore close() errors for all session-devices as their access
may be revoked asynchronously, or the device might get unplugged.
We use close_nointr() in case anyone ever looks at the return value (or
anyone runs "grep 'close(' -r src/" to find broken close() calls).
Fixes:
systemd-logind[31992]: Assertion 'close_nointr(fd) == 0' failed at src/shared/util.c:185, function close_nointr_nofail(). Aborting.
Diffstat (limited to 'units/suspend.target')
0 files changed, 0 insertions, 0 deletions