shared: use -EINVAL for _EXEC_COMMAND_FLAGS_INVALID

Follow-up of #11484
This commit is contained in:
Benjamin Robin
2021-02-16 23:34:58 +01:00
parent 925484aacb
commit 9de42a6a5f
2 changed files with 7 additions and 5 deletions
+6 -4
View File
@@ -381,10 +381,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;
@@ -400,6 +399,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);
+1 -1
View File
@@ -27,7 +27,7 @@ typedef enum ExecCommandFlags {
EXEC_COMMAND_NO_SETUID = 1 << 2,
EXEC_COMMAND_AMBIENT_MAGIC = 1 << 3,
EXEC_COMMAND_NO_ENV_EXPAND = 1 << 4,
_EXEC_COMMAND_FLAGS_INVALID = -1,
_EXEC_COMMAND_FLAGS_INVALID = -EINVAL,
} ExecCommandFlags;
int execute_directories(