Don't leave zombie processes if dmenu call fails

If dmenu didn't return anything we returned out of the function without
calling `waitpid` to collect the childs exit code, leaving to the child
process to be left as a zombie indefinitely. This commit makes `waitpid`
be called before the return checks are done.
This commit is contained in:
Nikos Tsipinakis 2017-02-23 20:09:09 +02:00
parent b034d31f80
commit c23af0e021
2 changed files with 6 additions and 5 deletions

View File

@ -7,7 +7,7 @@
- Support for raw icons
- `hide_duplicate_count` option to hide the number of duplicate notifications
- Support for per-urgency frame colours
- `markup` setting for more fine-gained control over how markup is handled
- `markup` setting for more fine-grained control over how markup is handled
- `history_ignore` rule action to exclude a notification from being added to the history
###Changed
@ -26,6 +26,7 @@
- Icon alignment with dynamic width
- Loading each line of the configuration file no longer relies on a static size buffer
- `ignore_newline` now works regardless of the markup setting
- dmenu process being left as a zombie if no option was selected
##1.1.0 - 2014-07-29
- fix nasty memory leak

View File

@ -201,7 +201,7 @@ void context_menu(void)
iter = iter->next) {
notification *n = iter->data;
if(n->urls)
if (n->urls)
dmenu_input = string_append(dmenu_input, n->urls, "\n");
if (n->actions)
@ -252,13 +252,13 @@ void context_menu(void)
close(child_io[1]);
size_t len = read(parent_io[0], buf, 1023);
waitpid(pid, NULL, 0);
if (len == 0) {
g_free(dmenu_input);
return;
}
int status;
waitpid(pid, &status, 0);
}
close(parent_io[0]);