summaryrefslogtreecommitdiffstats
path: root/src/core/dbus-execute.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-08-03 17:46:56 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-08-03 17:46:56 +0200
commita4fc96c823043df0dfba6823524a6f9df35bd5ac (patch)
treeccfb75dbffe945add9228983c1dd0411b30b7108 /src/core/dbus-execute.c
parentsd-hwdb: use return value from ordered_hashmap_iterate() (diff)
downloadsystemd-a4fc96c823043df0dfba6823524a6f9df35bd5ac.tar.xz
systemd-a4fc96c823043df0dfba6823524a6f9df35bd5ac.zip
pid1: replace asprintf() with strjoin()
It's nicer. And coverity doesn't need to complain about unchecked return value (CID#1401780).
Diffstat (limited to 'src/core/dbus-execute.c')
-rw-r--r--src/core/dbus-execute.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
index c816569f2b..85c310cd33 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -1000,16 +1000,11 @@ int bus_property_get_exec_ex_command_list(
}
static char *exec_command_flags_to_exec_chars(ExecCommandFlags flags) {
- char *res = NULL;
-
- asprintf(&res, "%s%s%s%s%s",
- FLAGS_SET(flags, EXEC_COMMAND_IGNORE_FAILURE) ? "-" : "",
- FLAGS_SET(flags, EXEC_COMMAND_NO_ENV_EXPAND) ? ":" : "",
- FLAGS_SET(flags, EXEC_COMMAND_FULLY_PRIVILEGED) ? "+" : "",
- FLAGS_SET(flags, EXEC_COMMAND_NO_SETUID) ? "!" : "",
- FLAGS_SET(flags, EXEC_COMMAND_AMBIENT_MAGIC) ? "!!" : "");
-
- return res;
+ return strjoin(FLAGS_SET(flags, EXEC_COMMAND_IGNORE_FAILURE) ? "-" : "",
+ FLAGS_SET(flags, EXEC_COMMAND_NO_ENV_EXPAND) ? ":" : "",
+ FLAGS_SET(flags, EXEC_COMMAND_FULLY_PRIVILEGED) ? "+" : "",
+ FLAGS_SET(flags, EXEC_COMMAND_NO_SETUID) ? "!" : "",
+ FLAGS_SET(flags, EXEC_COMMAND_AMBIENT_MAGIC) ? "!!" : "");
}
int bus_set_transient_exec_command(