summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-01-27 21:50:06 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-01-31 00:47:07 -0500
commit28a9ec4443458d99b3acbfb2d454515a5330118e (patch)
tree2297f2359cf01bb505b34d47685fc0cd02c82b6a
parent3ab2feefd7d1918e8f0d0edaea46a87cbed0f211 (diff)
downloadsystemd-28a9ec4443458d99b3acbfb2d454515a5330118e.tar.gz
logind: trivial simplification
free_and_strdup() handles NULL arg, so make use of that.
-rw-r--r--src/login/logind-dbus.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 3873bf3e96..ad44ca290e 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -2396,13 +2396,9 @@ static int method_set_wall_message(
if (r == 0)
return 1; /* Will call us back */
- if (isempty(wall_message))
- m->wall_message = mfree(m->wall_message);
- else {
- r = free_and_strdup(&m->wall_message, wall_message);
- if (r < 0)
- return log_oom();
- }
+ r = free_and_strdup(&m->wall_message, empty_to_null(wall_message));
+ if (r < 0)
+ return log_oom();
m->enable_wall_messages = enable_wall_messages;