diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-01-27 21:50:06 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-01-31 00:47:07 -0500 |
commit | 28a9ec4443458d99b3acbfb2d454515a5330118e (patch) | |
tree | 2297f2359cf01bb505b34d47685fc0cd02c82b6a | |
parent | 3ab2feefd7d1918e8f0d0edaea46a87cbed0f211 (diff) | |
download | systemd-28a9ec4443458d99b3acbfb2d454515a5330118e.tar.gz |
logind: trivial simplification
free_and_strdup() handles NULL arg, so make use of that.
-rw-r--r-- | src/login/logind-dbus.c | 10 |
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; |