summaryrefslogtreecommitdiffstats
path: root/lib/Utils
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-01-18 17:13:53 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-01-18 17:13:53 +0100
commit681785f7ad3f1aa7d3e8a974a3bcae2d1ad76aa6 (patch)
treed61ab540a4cc459ed0d3d8a45b08a11fd6cbacb2 /lib/Utils
parent3cd4d651565e4afcc3c72bd32bb9ce2285b5c93d (diff)
downloadabrt-681785f7ad3f1aa7d3e8a974a3bcae2d1ad76aa6.tar.gz
abrt-681785f7ad3f1aa7d3e8a974a3bcae2d1ad76aa6.tar.xz
abrt-681785f7ad3f1aa7d3e8a974a3bcae2d1ad76aa6.zip
CCpp analyzer: display __abort_msg in backtrace. closes rhbz#549735
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'lib/Utils')
-rw-r--r--lib/Utils/spawn.cpp36
1 files changed, 20 insertions, 16 deletions
diff --git a/lib/Utils/spawn.cpp b/lib/Utils/spawn.cpp
index d3e6ac6b..43c4b4a9 100644
--- a/lib/Utils/spawn.cpp
+++ b/lib/Utils/spawn.cpp
@@ -48,6 +48,22 @@ pid_t fork_execv_on_steroids(int flags,
if (child == 0) {
/* Child */
+ if (dir)
+ xchdir(dir);
+
+ if (flags & EXECFLG_SETGUID) {
+ struct passwd* pw = getpwuid(uid);
+ gid_t gid = pw ? pw->pw_gid : uid;
+ setgroups(1, &gid);
+ xsetregid(gid, gid);
+ xsetreuid(uid, uid);
+ }
+
+ if (unsetenv_vec) {
+ while (*unsetenv_vec)
+ unsetenv(*unsetenv_vec++);
+ }
+
/* Play with stdio descriptors */
if (flags & EXECFLG_INPUT) {
xmove_fd(pipe_to_child[0], STDIN_FILENO);
@@ -59,6 +75,10 @@ pid_t fork_execv_on_steroids(int flags,
} else if (flags & EXECFLG_OUTPUT_NUL) {
xmove_fd(xopen("/dev/null", O_RDWR), STDOUT_FILENO);
}
+
+ /* This should be done BEFORE stderr redirect */
+ VERB1 log("Executing: %s", concat_str_vector(argv).c_str());
+
if (flags & EXECFLG_ERR2OUT) {
/* Want parent to see errors in the same stream */
xdup2(STDOUT_FILENO, STDERR_FILENO);
@@ -66,25 +86,9 @@ pid_t fork_execv_on_steroids(int flags,
xmove_fd(xopen("/dev/null", O_RDWR), STDERR_FILENO);
}
- if (flags & EXECFLG_SETGUID) {
- struct passwd* pw = getpwuid(uid);
- gid_t gid = pw ? pw->pw_gid : uid;
- setgroups(1, &gid);
- xsetregid(gid, gid);
- xsetreuid(uid, uid);
- }
if (flags & EXECFLG_SETSID)
setsid();
- if (unsetenv_vec) {
- while (*unsetenv_vec)
- unsetenv(*unsetenv_vec++);
- }
-
- if (dir)
- xchdir(dir);
-
- VERB1 log("Executing: %s", concat_str_vector(argv).c_str());
execvp(argv[0], argv);
if (!(flags & EXECFLG_QUIET))
perror_msg("Can't execute '%s'", argv[0]);