mirror of
https://github.com/FRRouting/frr.git
synced 2025-04-30 13:37:17 +02:00
vtysh: Exit with first received error code when forking
vtysh -f forks. Gather the return codes and report the first failed return code. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
ac76809027
commit
172b231c03
|
@ -682,11 +682,21 @@ int vtysh_apply_config(const char *config_file_path, bool dry_run, bool do_fork)
|
|||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue