mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
run: clean up ExecCommandFlags serialization
The current behavior is actually OK, since use_ex_prop = !arg_expand_environment, but that's very implicit and using STRV_MAKE() this way feels icky. Let's make this more readable, by using exec_command_flags_to_strv().
This commit is contained in:
parent
05c754bc7f
commit
db12f84327
@ -21,6 +21,7 @@
|
||||
#include "chase.h"
|
||||
#include "env-util.h"
|
||||
#include "escape.h"
|
||||
#include "exec-util.h"
|
||||
#include "exit-status.h"
|
||||
#include "fd-util.h"
|
||||
#include "format-util.h"
|
||||
@ -1246,12 +1247,17 @@ static int transient_service_set_properties(sd_bus_message *m, const char *pty_p
|
||||
if (r < 0)
|
||||
return bus_log_create_error(r);
|
||||
|
||||
if (use_ex_prop)
|
||||
r = sd_bus_message_append_strv(
|
||||
m,
|
||||
STRV_MAKE(arg_expand_environment > 0 ? NULL : "no-env-expand",
|
||||
arg_ignore_failure ? "ignore-failure" : NULL));
|
||||
else
|
||||
if (use_ex_prop) {
|
||||
_cleanup_strv_free_ char **opts = NULL;
|
||||
|
||||
r = exec_command_flags_to_strv(
|
||||
(arg_expand_environment > 0 ? 0 : EXEC_COMMAND_NO_ENV_EXPAND)|(arg_ignore_failure ? EXEC_COMMAND_IGNORE_FAILURE : 0),
|
||||
&opts);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to format execute flags: %m");
|
||||
|
||||
r = sd_bus_message_append_strv(m, opts);
|
||||
} else
|
||||
r = sd_bus_message_append(m, "b", arg_ignore_failure);
|
||||
if (r < 0)
|
||||
return bus_log_create_error(r);
|
||||
|
Loading…
Reference in New Issue
Block a user