X-Git-Url: http://git.tdb.fi/?p=pmount-gui.git;a=blobdiff_plain;f=main.c;h=bed5e1bf0dd0964c69e6fa161816e6d05a9ec075;hp=63921300b2bf373105ae557e773295b0d74489c4;hb=ccc2b1b7ed981618ac13bedf540de24256d4431f;hpb=a82201f388e8d4b4b5b10b9547c3ee3a4e488586 diff --git a/main.c b/main.c index 6392130..bed5e1b 100644 --- a/main.c +++ b/main.c @@ -570,7 +570,7 @@ void row_activated(GtkTreeView *list, GtkTreePath *path, GtkTreeViewColumn *colu { char buf[1024]; int pos = 0; - int status; + int status = 0; fd_set fds; struct timeval timeout; @@ -592,11 +592,32 @@ void row_activated(GtkTreeView *list, GtkTreePath *path, GtkTreeViewColumn *colu pos += len; } else if(waitpid(pid, &status, 0)) + { + pid = 0; break; + } } + if(pid) + waitpid(pid, &status, 0); + buf[pos] = 0; + if(verbosity>=1) + { + if(WIFEXITED(status)) + { + if(WEXITSTATUS(status)) + printf("Command exited successfully\n"); + else + printf("Command exited with status %d\n", WEXITSTATUS(status)); + } + else if(WIFSIGNALED(status)) + printf("Command terminated with signal %d\n", WTERMSIG(status)); + else + printf("Command exited with unknown result %04X\n", status); + } + if(!WIFEXITED(status) || WEXITSTATUS(status)) { GtkWidget *dialog; @@ -608,9 +629,6 @@ void row_activated(GtkTreeView *list, GtkTreePath *path, GtkTreeViewColumn *colu else gtk_main_quit(); } - else - { - } } (void)column;