From: Anjali Nijhara Date: Thu, 14 Dec 2023 08:39:21 +0000 (+0530) Subject: Modify run_notify func to wait for terminating child process X-Git-Tag: accepted/tizen/unified/20231214.164957^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F38%2F302838%2F1;p=platform%2Fupstream%2Ftoybox.git Modify run_notify func to wait for terminating child process Change-Id: Iec382fb152dcbcd3bf5511ce19c4235679365c75 --- diff --git a/toys/pending/dhcpd.c b/toys/pending/dhcpd.c index 213a941..0a3a2c5 100644 --- a/toys/pending/dhcpd.c +++ b/toys/pending/dhcpd.c @@ -1186,6 +1186,8 @@ static void run_notify(char **argv) struct stat sts; volatile int error = 0; pid_t pid; + int rv = 0; + dbg("run_notify"); if (stat(argv[0], &sts) == -1 && errno == ENOENT) { infomsg(infomode, "notify file: %s : not exist.", argv[0]); @@ -1203,11 +1205,9 @@ static void run_notify(char **argv) error = errno; _exit(111); } - if (error) { - waitpid(pid, NULL, 0); - errno = error; - } - dbg("script complete.\n"); + waitpid(pid, &rv, 0); + errno = error; + dbg("wait pid (%u) rv (%d)", pid, rv); } static void write_leasefile(void)