summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichal Sekletar <msekleta@redhat.com>2013-09-12 15:42:24 +0200
committerLennart Poettering <lennart@poettering.net>2013-09-12 18:09:08 +0200
commitc1e784feb4756226f09a94feeed81a3c0d9aac5e (patch)
tree87f55ceb8bcb4f4bd91d9858eb373950f8c9252f /src
parent7de778beab01a3184ee37a3e3b8cf23f40b996e4 (diff)
systemctl: process only signals for jobs we really wait for
wait_filter() callback shouldn't process JobRemove signals for arbitrary jobs. It should only deal with signals for jobs which are included in set of jobs we wait for.
Diffstat (limited to 'src')
-rw-r--r--src/systemctl/systemctl.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index a305c3d87d..dc3e41bf42 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -1494,7 +1494,7 @@ static DBusHandlerResult wait_filter(DBusConnection *connection, DBusMessage *me
} else if (dbus_message_is_signal(message, "org.freedesktop.systemd1.Manager", "JobRemoved")) {
uint32_t id;
- const char *path, *result, *unit;
+ const char *path, *result, *unit, *r;
if (dbus_message_get_args(message, &error,
DBUS_TYPE_UINT32, &id,
@@ -1503,7 +1503,11 @@ static DBusHandlerResult wait_filter(DBusConnection *connection, DBusMessage *me
DBUS_TYPE_STRING, &result,
DBUS_TYPE_INVALID)) {
- free(set_remove(d->set, (char*) path));
+ r = set_remove(d->set, (char*) path);
+ if (!r)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ free(r);
if (!isempty(result))
d->result = strdup(result);
@@ -1523,7 +1527,11 @@ static DBusHandlerResult wait_filter(DBusConnection *connection, DBusMessage *me
/* Compatibility with older systemd versions <
* 183 during upgrades. This should be dropped
* one day. */
- free(set_remove(d->set, (char*) path));
+ r = set_remove(d->set, (char*) path);
+ if (!r)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+ free(r);
if (*result)
d->result = strdup(result);