Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vtysh fork #13004

Merged
merged 5 commits into from
Mar 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
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>
  • Loading branch information
donaldsharp committed Mar 28, 2023
commit 172b231c0388e9e6b27f317ce86d315b1f8353bf
16 changes: 13 additions & 3 deletions vtysh/vtysh_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/*
Expand Down