chiark / gitweb /
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)
committerSven Eden <yamakuzure@gmx.net>
Wed, 29 Mar 2017 08:45:08 +0000 (10:45 +0200)
commit9277945f9aca8ed56f8575ab3c6bab5ace859d3a
tree9042ec52910c1493d7269a40dcbeb744f0203cf2
parentd7834101faf86dfa00e2ac3d9c3dd746852402eb
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/libelogind/sd-daemon/sd-daemon.c