Modify run_notify func to wait for terminating child process 38/302838/1 accepted/tizen_unified_riscv accepted/tizen/unified/20231214.164957 accepted/tizen/unified/riscv/20231226.211128
authorAnjali Nijhara <a.nijhara@samsung.com>
Thu, 14 Dec 2023 08:39:21 +0000 (14:09 +0530)
committerAnjali Nijhara <a.nijhara@samsung.com>
Thu, 14 Dec 2023 08:39:21 +0000 (14:09 +0530)
Change-Id: Iec382fb152dcbcd3bf5511ce19c4235679365c75

toys/pending/dhcpd.c

index 213a941..0a3a2c5 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)