summaryrefslogtreecommitdiff
path: root/src/shared/exec-util.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-02-17 08:46:09 +0100
committerGitHub <noreply@github.com>2021-02-17 08:46:09 +0100
commit4c1ff29052705c499c0a59e96c1ea14bea635f8e (patch)
treeab1be33583d003c87526700d4c77dde7563f18ff /src/shared/exec-util.c
parent68337e55f62cf49b7bdfb73dc5662e23b0ea17fa (diff)
parent0e2d092d43e2dfe09883ce6bfa0cdde5380de39c (diff)
downloadsystemd-4c1ff29052705c499c0a59e96c1ea14bea635f8e.tar.gz
Merge pull request #18641 from benjarobin/fix-enum-invalid-val
Various follow-up: Fix build and EINVAL for _INVALID enum value
Diffstat (limited to 'src/shared/exec-util.c')
-rw-r--r--src/shared/exec-util.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/shared/exec-util.c b/src/shared/exec-util.c
index 1557086079..031ca4cb4c 100644
--- a/src/shared/exec-util.c
+++ b/src/shared/exec-util.c
@@ -375,10 +375,9 @@ int exec_command_flags_from_strv(char **ex_opts, ExecCommandFlags *flags) {
STRV_FOREACH(opt, ex_opts) {
ex_flag = exec_command_flags_from_string(*opt);
- if (ex_flag >= 0)
- ret_flags |= ex_flag;
- else
- return -EINVAL;
+ if (ex_flag < 0)
+ return ex_flag;
+ ret_flags |= ex_flag;
}
*flags = ret_flags;
@@ -394,6 +393,9 @@ int exec_command_flags_to_strv(ExecCommandFlags flags, char ***ex_opts) {
assert(ex_opts);
+ if (flags < 0)
+ return flags;
+
for (i = 0; it != 0; it &= ~(1 << i), i++) {
if (FLAGS_SET(flags, (1 << i))) {
str = exec_command_flags_to_string(1 << i);