[systemd-commits] 6 commits - man/daemon.xml src/core src/fstab-generator src/libsystemd
Zbigniew JÄdrzejewski-Szmek
zbyszek at kemper.freedesktop.org
Fri Oct 3 17:42:38 PDT 2014
man/daemon.xml | 9 +++++----
src/core/namespace.c | 14 ++++----------
src/fstab-generator/fstab-generator.c | 8 ++------
src/libsystemd/sd-bus/bus-kernel.c | 25 ++++++++++++++-----------
src/libsystemd/sd-event/sd-event.c | 10 ++++++----
5 files changed, 31 insertions(+), 35 deletions(-)
New commits:
commit f88dc3edeb9c49622fcc773cb6153238fe9efbe2
Author: Tobias Hunger <tobias.hunger at digia.com>
Date: Fri Oct 3 20:41:43 2014 -0400
fstab-generator: Small cleanup
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index 5dafcba..b75bbb7 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -511,16 +511,12 @@ static int parse_proc_cmdline_item(const char *key, const char *value) {
} else if (streq(key, "root") && value) {
- free(arg_root_what);
- arg_root_what = strdup(value);
- if (!arg_root_what)
+ if (free_and_strdup(&arg_root_what, value) < 0)
return log_oom();
} else if (streq(key, "rootfstype") && value) {
- free(arg_root_fstype);
- arg_root_fstype = strdup(value);
- if (!arg_root_fstype)
+ if (free_and_strdup(&arg_root_fstype, value) < 0)
return log_oom();
} else if (streq(key, "rootflags") && value) {
commit 125dd07483b6836106ff9ad3ce1737d8a6c56c59
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Fri Oct 3 19:47:47 2014 -0400
sd-bus: split out cleanup into separate function
m is always non-null at this point. This function is too long anyway.
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index 0c39e22..09ff25f 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -332,6 +332,18 @@ fail:
return r;
}
+static void unset_memfds(struct sd_bus_message *m) {
+ struct bus_body_part *part;
+ unsigned i;
+
+ assert(m);
+
+ /* Make sure the memfds are not freed twice */
+ MESSAGE_FOREACH_PART(part, i, m)
+ if (part->memfd >= 0)
+ part->memfd = -1;
+}
+
static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) {
sd_bus_message *m = NULL;
struct kdbus_item *d;
@@ -627,17 +639,8 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) {
return 1;
fail:
- if (m) {
- struct bus_body_part *part;
- unsigned i;
-
- /* Make sure the memfds are not freed twice */
- MESSAGE_FOREACH_PART(part, i, m)
- if (part->memfd >= 0)
- part->memfd = -1;
-
- sd_bus_message_unref(m);
- }
+ unset_memfds(m);
+ sd_bus_message_unref(m);
return r;
}
commit d267c5aa3d0fe4960165a1e1c00a840eef8b7d00
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Fri Oct 3 19:17:56 2014 -0400
core/namespace: remove invalid check
dir cannot be NULL here, because it was allocated with alloca.
CID #1237768.
diff --git a/src/core/namespace.c b/src/core/namespace.c
index f86092f..c221509 100644
--- a/src/core/namespace.c
+++ b/src/core/namespace.c
@@ -263,11 +263,8 @@ fail:
if (devmqueue)
umount(devmqueue);
- if (dev) {
- umount(dev);
- rmdir(dev);
- }
-
+ umount(dev);
+ rmdir(dev);
rmdir(temporary_mount);
return r;
commit 1775f1ebc4a8e9e0e2e4a9af3e97e1408c9cb335
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Fri Oct 3 19:16:11 2014 -0400
core/namespace: remove invalid check
root cannot be NULL here, because it was allocated with alloca.
CID #1237769.
diff --git a/src/core/namespace.c b/src/core/namespace.c
index f76d389..f86092f 100644
--- a/src/core/namespace.c
+++ b/src/core/namespace.c
@@ -341,11 +341,8 @@ fail:
unlink(busnode);
}
- if (root) {
- umount(root);
- rmdir(root);
- }
-
+ umount(root);
+ rmdir(root);
rmdir(temporary_mount);
return r;
commit 7057bd993110c1eff0cd3a8776902ca66417634e
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Fri Oct 3 18:49:45 2014 -0400
sd-event: check the value of received signal
Appease coverity report #1237775.
Also rename ss to n, to make it visually different from ss.
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index b56182d..4c67ee8 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -1973,20 +1973,22 @@ static int process_signal(sd_event *e, uint32_t events) {
for (;;) {
struct signalfd_siginfo si;
- ssize_t ss;
+ ssize_t n;
sd_event_source *s = NULL;
- ss = read(e->signal_fd, &si, sizeof(si));
- if (ss < 0) {
+ n = read(e->signal_fd, &si, sizeof(si));
+ if (n < 0) {
if (errno == EAGAIN || errno == EINTR)
return read_one;
return -errno;
}
- if (_unlikely_(ss != sizeof(si)))
+ if (_unlikely_(n != sizeof(si)))
return -EIO;
+ assert(si.ssi_signo < _NSIG);
+
read_one = true;
if (si.ssi_signo == SIGCHLD) {
commit 610158048a03f25be88a36cb7c81d11177a2c559
Author: Zbigniew JÄdrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Fri Oct 3 17:44:23 2014 -0400
man: use more markup in daemon(7)
diff --git a/man/daemon.xml b/man/daemon.xml
index a23a047..99c75a7 100644
--- a/man/daemon.xml
+++ b/man/daemon.xml
@@ -85,13 +85,14 @@
with a fallback of iterating from file
descriptor 3 to the value returned by
<function>getrlimit()</function> for
- RLIMIT_NOFILE.</para></listitem>
+ <constant>RLIMIT_NOFILE</constant>.
+ </para></listitem>
<listitem><para>Reset all signal
handlers to their default. This is
best done by iterating through the
available signals up to the limit of
- _NSIG and resetting them to
+ <constant>_NSIG</constant> and resetting them to
<constant>SIG_DFL</constant>.</para></listitem>
<listitem><para>Reset the signal mask
@@ -330,7 +331,7 @@
init system. If log priorities are
necessary, these can be encoded by
prefixing individual log lines with
- strings like "<4>" (for log
+ strings like <literal><4></literal> (for log
priority 4 "WARNING" in the syslog
priority scheme), following a similar
style as the Linux kernel's
@@ -610,7 +611,7 @@
on a network interface, because network
sockets shall be bound to the
address. However, an alternative to implement
- this is by utilizing the Linux IP_FREEBIND
+ this is by utilizing the Linux <constant>IP_FREEBIND</constant>
socket option, as accessible via
<varname>FreeBind=yes</varname> in systemd
socket files (see
More information about the systemd-commits
mailing list