vtysh -f forks. Gather the return codes and report the first
failed return code.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
/* parent, wait for children */
if (fork_pid != 0) {
+ int keep_status = 0;
+
fprintf(stdout,
"Waiting for children to finish applying config...\n");
- while (wait(&status) > 0)
- ;
- return 0;
+ while (wait(&status) > 0) {
+ if (!keep_status && WEXITSTATUS(status))
+ keep_status = WEXITSTATUS(status);
+ }
+
+ /*
+ * This will return the first status received
+ * that failed( if that happens ). This is
+ * good enough for the moment
+ */
+ return keep_status;
}
/*