From bc3de38aa71e67d6b369c0c2f26dd91357676c33 Mon Sep 17 00:00:00 2001 From: fwsmit Date: Thu, 21 Jan 2021 16:48:20 +0100 Subject: [PATCH] Slightly simplify and document script executing --- src/notification.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/notification.c b/src/notification.c index b91a3d4..7ed4364 100644 --- a/src/notification.c +++ b/src/notification.c @@ -129,6 +129,7 @@ void notification_run_script(struct notification *n) int status; waitpid(pid1, &status, 0); } else { + // second fork to prevent zombie processes int pid2 = fork(); if (pid2) { exit(0); @@ -153,7 +154,7 @@ void notification_run_script(struct notification *n) safe_setenv("DUNST_TIMESTAMP", n_timestamp_str); safe_setenv("DUNST_STACK_TAG", n->stack_tag); - int ret = execlp(script, + execlp(script, script, appname, summary, @@ -161,10 +162,9 @@ void notification_run_script(struct notification *n) icon, urgency, (char *)NULL); - if (ret != 0) { - LOG_W("Unable to run script %s: %s", n->scripts[i], strerror(errno)); - exit(EXIT_FAILURE); - } + + LOG_W("Unable to run script %s: %s", n->scripts[i], strerror(errno)); + exit(EXIT_FAILURE); } } }