diff options
| author | Karel Klic <kklic@redhat.com> | 2011-03-09 16:49:41 +0100 |
|---|---|---|
| committer | Karel Klic <kklic@redhat.com> | 2011-03-09 16:58:28 +0100 |
| commit | 43d84e3f11e46b7c9a042ff338024dfc41bb4f22 (patch) | |
| tree | 783b1122556f15345290ff8b1623812b6e864827 /src/lib/spawn.c | |
| parent | 6ec12db137f2d0fe18f059fcef2390512d0b2c3f (diff) | |
| parent | c2f2a9f310e7b3bc3725cc8dc7e805fd38c7fbbd (diff) | |
| download | abrt-43d84e3f11e46b7c9a042ff338024dfc41bb4f22.tar.gz abrt-43d84e3f11e46b7c9a042ff338024dfc41bb4f22.tar.xz abrt-43d84e3f11e46b7c9a042ff338024dfc41bb4f22.zip | |
Merge branch 'master' of ssh://git.fedorahosted.org/git/abrt
Diffstat (limited to 'src/lib/spawn.c')
| -rw-r--r-- | src/lib/spawn.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/lib/spawn.c b/src/lib/spawn.c index f6b7263c..188b63bd 100644 --- a/src/lib/spawn.c +++ b/src/lib/spawn.c @@ -32,7 +32,7 @@ static char *concat_str_vector(char **strings) pid_t fork_execv_on_steroids(int flags, char **argv, int *pipefds, - char **unsetenv_vec, + char **env_vec, const char *dir, uid_t uid) { @@ -69,9 +69,11 @@ pid_t fork_execv_on_steroids(int flags, xsetreuid(uid, uid); } - if (unsetenv_vec) { - while (*unsetenv_vec) - unsetenv(*unsetenv_vec++); + if (env_vec) { + /* Note: we use the glibc extension that putenv("var") + * *unsets* $var if "var" string has no '=' */ + while (*env_vec) + putenv(*env_vec++); } /* Play with stdio descriptors */ @@ -134,7 +136,7 @@ char *run_in_shell_and_save_output(int flags, const char *argv[] = { "/bin/sh", "-c", cmd, NULL }; int pipeout[2]; pid_t child = fork_execv_on_steroids(flags, (char **)argv, pipeout, - /*unsetenv_vec:*/ NULL, dir, /*uid (unused):*/ 0); + /*env_vec:*/ NULL, dir, /*uid (unused):*/ 0); size_t pos = 0; char *result = NULL; |
