sd-daemon: fix sd_is_mq for non-mq fds
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 5 Sep 2015 13:20:15 +0000 (15:20 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 30 Sep 2015 18:23:13 +0000 (14:23 -0400)
commit0260d1d542da73b3358fa659fb1fa634badbf00e
tree0eba0f98522c5e456c7edc4a9023bf8c2c192293
parent7bbb5359c0a23061c9bd40e6f7c2a0afbf2906f8
sd-daemon: fix sd_is_mq for non-mq fds

mq_getattr returns -1/EBADF for file descriptors which are not mq.
But we should return 0 in this case.

We first check that fd is a valid fd, so we can assume that if
mq_getattr returns EBADF, it is simply a non-mq fd. There is a slight
race, but there doesn't seem to be a nice way to fix it.
src/libsystemd/sd-daemon/sd-daemon.c