aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2020-02-09 05:06:12 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2020-02-09 05:06:42 +0700
commit979c3b7e7ec87f79c8b20af6418264fa7c6c9f5b (patch)
treee3ae9df1bcd3a6d7d9e9b9f75d4f599009fb16b4 /src
parentd419f652bbf282bbb6353429261776d6293fcfb6 (diff)
exec: propogate errors from osmo_environment_[filter|append]
Diffstat (limited to 'src')
-rw-r--r--src/exec.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/exec.c b/src/exec.c
index b806ad56..62f59194 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -221,10 +221,16 @@ int osmo_system_nowait(const char *command, const char **env_whitelist, char **a
new_env[0] = NULL;
/* build the new environment */
- if (env_whitelist)
- osmo_environment_filter(new_env, ARRAY_SIZE(new_env), environ, env_whitelist);
- if (addl_env)
- osmo_environment_append(new_env, ARRAY_SIZE(new_env), addl_env);
+ if (env_whitelist) {
+ rc = osmo_environment_filter(new_env, ARRAY_SIZE(new_env), environ, env_whitelist);
+ if (rc < 0)
+ return rc;
+ }
+ if (addl_env) {
+ rc = osmo_environment_append(new_env, ARRAY_SIZE(new_env), addl_env);
+ if (rc < 0)
+ return rc;
+ }
/* if we want to behave like system(3), we must go via the shell */
execle("/bin/sh", "sh", "-c", command, (char *) NULL, new_env);