diff options
| author | Karel Klic <kklic@redhat.com> | 2009-10-22 14:38:55 +0200 |
|---|---|---|
| committer | Karel Klic <kklic@redhat.com> | 2009-10-22 14:38:55 +0200 |
| commit | eec58f224eda6415f58907f37efb2f3e51453362 (patch) | |
| tree | 5dc0b525a4b2c187dae423e9d9603f742207f525 /src/CLI/run-command.cpp | |
| parent | 71571cc968cf8b002eee6761be96b8af7969483f (diff) | |
| parent | 326f6403b29aa2e2932826dc6facb567ebac8ab7 (diff) | |
| download | abrt-eec58f224eda6415f58907f37efb2f3e51453362.tar.gz abrt-eec58f224eda6415f58907f37efb2f3e51453362.tar.xz abrt-eec58f224eda6415f58907f37efb2f3e51453362.zip | |
Merge branch 'master' of ssh://git.fedorahosted.org/git/abrt
Diffstat (limited to 'src/CLI/run-command.cpp')
| -rw-r--r-- | src/CLI/run-command.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/CLI/run-command.cpp b/src/CLI/run-command.cpp index df29b0e..80184cf 100644 --- a/src/CLI/run-command.cpp +++ b/src/CLI/run-command.cpp @@ -23,7 +23,7 @@ http://git.kernel.org/?p=git/git.git;a=blob;f=run-command.c;hb=HEAD */ -struct child_process +struct child_process { const char **argv; pid_t pid; @@ -51,28 +51,28 @@ static int finish_command(struct child_process *cmd) int status, code = -1; while ((waiting = waitpid(cmd->pid, &status, 0)) < 0 && errno == EINTR) ; /* nothing */ - - if (waiting < 0) + + if (waiting < 0) error_msg_and_die("waitpid for %s failed: %s", cmd->argv[0], strerror(errno)); - else if (waiting != cmd->pid) + else if (waiting != cmd->pid) error_msg_and_die("waitpid is confused (%s)", cmd->argv[0]); - else if (WIFSIGNALED(status)) + else if (WIFSIGNALED(status)) { code = WTERMSIG(status); error_msg("%s died of signal %d", cmd->argv[0], code); - } - else if (WIFEXITED(status)) + } + else if (WIFEXITED(status)) { code = WEXITSTATUS(status); - if (code == 127) + if (code == 127) { code = -1; error_msg_and_die("cannot run %s: %s", cmd->argv[0], strerror(ENOENT)); } - } - else + } + else error_msg_and_die("waitpid is confused (%s)", cmd->argv[0]); - + return code; } |
