Age | Commit message (Collapse) | Author |
|
<fcntl.h> is POSIX. On Linux, <sys/fcntl.h> simply includes
<fcntl.h>, so there should be on difference. On Android
likewise, except that there is some more stuff. QNX has
only <fcntl.h>.
https://bugs.freedesktop.org/show_bug.cgi?id=63423
|
|
|
|
In recent glibc, many commonly-used librt functions have moved
from librt to libc. This results in dbus' configure.ac
concluding that we don't need to link in librt. However,
sd-daemon.c needs it for mq_getattr(), causing the build
to fail.
dbus doesn't use POSIX message queues, so I'd prefer to be
able to avoid "if on Linux, link librt for sd-daemon.c".
|
|
gcc thinks that errno might be negative, and functions could return
something positive on error (-errno). Should not matter in practice,
but makes an -O4 build much quieter.
|
|
Previously we were testing whether /sys/fs/cgroup/systemd/ was a mount
point. This might be problematic however, when the cgroup trees are bind
mounted into a container from the host (which should be absolutely
valid), which might create the impression that the container was running
systemd, but only the host actually is.
Replace this by a check for the existance of the directory
/run/systemd/system/, which should work unconditionally, since /run can
never be a bind mount but *must* be a tmpfs on systemd systems, which is
flushed at boots. This means that data in /run always reflects
information about the current boot, and only of the local container,
which makes it the perfect choice for a check like this.
(As side effect this is nice to Ubuntu people who now use logind with
the systemd cgroup hierarchy, where the old sd_booted() check misdetects
systemd, even though they still run legacy Upstart.)
|
|
It is only needed in files designed to be usable in standalone
compilation. In those files the #ifdefinery is indented. When
compiling in-tree, GNU_SOURCE is always defined, so remove one
definition.
|
|
Found with 'cppcheck --enable=all --inconclusive --std=posix' while
working with util-linux, which has a copy of this file.
[misc-utils/sd-daemon.c:363]: (style) Checking if unsigned variable \
'length' is less than zero.
[misc-utils/sd-daemon.c:366]: (style) Checking if unsigned variable \
'length' is less than zero.
References: http://www.spinics.net/lists/util-linux-ng/msg07031.html
|
|
|
|
strtol() and friends may set EINVAL if no conversion was performed, but
they are not required to do so. In practice they don't. We need to check
for it.
https://bugzilla.redhat.com/show_bug.cgi?id=870577
|
|
There is no point in clearing the bits of a "struct stat" when the very
next statement just calls stat or fstat to fill in that same memory.
[zj: two more places]
|
|
|
|
|
|
|