[systemd-commits] 3 commits - src/core
Zbigniew Jędrzejewski-Szmek
zbyszek at kemper.freedesktop.org
Sun Nov 23 16:30:36 PST 2014
src/core/dbus.c | 2 +-
src/core/main.c | 5 +----
src/core/manager.c | 8 +++++---
src/core/manager.h | 2 +-
src/core/mount.c | 25 ++++++++++++++++---------
5 files changed, 24 insertions(+), 18 deletions(-)
New commits:
commit 056edeb9102c5ba455e1a54af70f282b6138ca33
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Wed Nov 5 22:39:13 2014 -0500
manager: only issue overmount warning when the check succeeded
If for any reason the check failed (selinux?), we would still issue
the warning. Check the return status.
diff --git a/src/core/mount.c b/src/core/mount.c
index 8b787f6..b571db9 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -814,19 +814,26 @@ fail:
}
void warn_if_dir_nonempty(const char *unit, const char* where) {
+ int r;
+
assert(unit);
assert(where);
- if (dir_is_empty(where) > 0)
+ r = dir_is_empty(where);
+ if (r > 0)
return;
-
- log_struct_unit(LOG_NOTICE,
- unit,
- "MESSAGE=%s: Directory %s to mount over is not empty, mounting anyway.",
- unit, where,
- "WHERE=%s", where,
- MESSAGE_ID(SD_MESSAGE_OVERMOUNTING),
- NULL);
+ else if (r == 0)
+ log_struct_unit(LOG_NOTICE,
+ unit,
+ "MESSAGE=%s: Directory %s to mount over is not empty, mounting anyway.",
+ unit, where,
+ "WHERE=%s", where,
+ MESSAGE_ID(SD_MESSAGE_OVERMOUNTING),
+ NULL);
+ else
+ log_warning_unit(unit,
+ "MESSAGE=Failed to check directory %s: %s",
+ where, strerror(-r));
}
static int fail_if_symlink(const char *unit, const char* where) {
commit 06d8d842e9de8656d9a46926e7ae7ff967b69ef8
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date: Sat Nov 8 10:06:12 2014 -0500
manager: let manager_free() handle NULLs
This makes the calling code a bit simpler.
diff --git a/src/core/main.c b/src/core/main.c
index 64acdf7..b44e7f9 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1799,10 +1799,7 @@ int main(int argc, char *argv[]) {
finish:
pager_close();
- if (m) {
- manager_free(m);
- m = NULL;
- }
+ m = manager_free(m);
for (j = 0; j < ELEMENTSOF(arg_default_rlimit); j++) {
free(arg_default_rlimit[j]);
diff --git a/src/core/manager.c b/src/core/manager.c
index 7abc8a9..4c3264b 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -889,11 +889,12 @@ static void manager_clear_jobs_and_units(Manager *m) {
m->n_running_jobs = 0;
}
-void manager_free(Manager *m) {
+Manager* manager_free(Manager *m) {
UnitType c;
int i;
- assert(m);
+ if (!m)
+ return NULL;
manager_clear_jobs_and_units(m);
@@ -955,6 +956,7 @@ void manager_free(Manager *m) {
hashmap_free(m->units_requiring_mounts_for);
free(m);
+ return NULL;
}
int manager_enumerate(Manager *m) {
diff --git a/src/core/manager.h b/src/core/manager.h
index ab72548..0253502 100644
--- a/src/core/manager.h
+++ b/src/core/manager.h
@@ -296,7 +296,7 @@ struct Manager {
};
int manager_new(SystemdRunningAs running_as, bool test_run, Manager **m);
-void manager_free(Manager *m);
+Manager* manager_free(Manager *m);
int manager_enumerate(Manager *m);
int manager_startup(Manager *m, FILE *serialization, FDSet *fds);
commit f44b9efcec4594eb8f843325ee3079b44fb8f24a
Author: Lukas Nykryn <lnykryn at redhat.com>
Date: Thu Nov 20 16:06:18 2014 +0100
dbus: return non-zero return value in the case that prefix won't match
strv_extend returns 0 in the case of success which means that
else if (bus_track_deserialize_item(&m->deserialized_subscribed, l) == 0)
log_warning("Unknown serialization item '%s'", l);
will be printed when value is added correctly.
diff --git a/src/core/dbus.c b/src/core/dbus.c
index 9cb198a..ec1c0d4 100644
--- a/src/core/dbus.c
+++ b/src/core/dbus.c
@@ -1180,7 +1180,7 @@ int bus_track_deserialize_item(char ***l, const char *line) {
e = startswith(line, "subscribed=");
if (!e)
- return 0;
+ return -EINVAL;
return strv_extend(l, e);
}
diff --git a/src/core/manager.c b/src/core/manager.c
index 2bc1058..7abc8a9 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -2408,7 +2408,7 @@ int manager_deserialize(Manager *m, FILE *f, FDSet *fds) {
m->kdbus_fd = fdset_remove(fds, fd);
}
- } else if (bus_track_deserialize_item(&m->deserialized_subscribed, l) == 0)
+ } else if (bus_track_deserialize_item(&m->deserialized_subscribed, l) < 0)
log_warning("Unknown serialization item '%s'", l);
}
More information about the systemd-commits
mailing list