Commit graph

13 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek abad76cc4c Include <fcntl.h> instead of <sys/fcntl.h>
<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
2013-04-13 21:02:03 -04:00
Zbigniew Jędrzejewski-Szmek 1c6330456c Use initalization instead of explicit zeroing in more places 2013-04-10 18:59:42 -04:00
Simon McVittie 9735bd12ab sd-daemon.c: allow use of -lrt to be avoided
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".
2013-04-08 13:54:31 +02:00
Zbigniew Jędrzejewski-Szmek 8333c77edf Always use errno > 0 to help gcc
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.
2013-03-29 10:12:41 -04:00
Lennart Poettering 66e411811b sd-booted: update sd_booted() check a bit
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.)
2013-03-15 16:49:08 +01:00
Zbigniew Jędrzejewski-Szmek 24be982274 Remove or indent #define GNU_SOURCE
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.
2013-03-11 18:03:13 -04:00
Sami Kerola d1d7caeeee sd-daemon: fix cppcheck warnings
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
2012-12-17 11:41:31 +01:00
Michal Schmidt 50425d1614 libsystemd-daemon: fix style 2012-10-30 10:30:44 +01:00
Michal Schmidt f3910003bc shared, libsystemd-daemon: check for empty strings in strto*l conversions
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
2012-10-30 10:30:04 +01:00
Jim Meyering 956b78e8e3 sd-daemon: remove unnecessary memset calls
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]
2012-07-23 00:06:06 +02:00
Kay Sievers 3b6d9a7c50 update .gitignore 2012-04-13 21:58:01 +02:00
Lennart Poettering b562f5a57d build-sys: add stub makefiles to all subdirs to ease development with emacs 2012-04-13 21:37:59 +02:00
Kay Sievers d41ba529b4 move libsystemd-id128, libsystemd-daemon to subdir 2012-04-12 15:26:39 +02:00