Modify run_notify func to wait for terminating child process 41/305941/1 accepted/tizen_7.0_unified tizen_7.0 accepted/tizen/7.0/unified/20240219.160845
authorAnjali Nijhara <a.nijhara@samsung.com>
Thu, 14 Dec 2023 08:39:21 +0000 (14:09 +0530)
committerAnjali Nijhara <a.nijhara@samsung.com>
Tue, 13 Feb 2024 10:56:15 +0000 (16:26 +0530)
Change-Id: Iec382fb152dcbcd3bf5511ce19c4235679365c75

toys/pending/dhcpd.c

index 9f1f9ad..3bac14d 100644 (file)
@@ -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)