From 1bbd7cf1a099f17238b53fe33e048e267d0387ad Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Tue, 7 Oct 2008 22:57:51 +0000 Subject: [PATCH] fix command line output in debug mode for srun, et. al. previously only printed the last argv value. --- src/common/proc_args.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/common/proc_args.c b/src/common/proc_args.c index ed6d9de0307..cede1aed102 100644 --- a/src/common/proc_args.c +++ b/src/common/proc_args.c @@ -624,12 +624,17 @@ search_path(char *cwd, char *cmd, bool check_current_dir, int access_mode) char *print_commandline(const int script_argc, char **script_argv) { int i; - char buf[256]; + char tmp[256], *out_buf = NULL, *prefix; - buf[0] = '\0'; - for (i = 0; i < script_argc; i++) - snprintf(buf, 256, "%s", script_argv[i]); - return xstrdup(buf); + for (i = 0; i < script_argc; i++) { + if (out_buf) + prefix = " "; + else + prefix = ""; + snprintf(tmp, 256, "%s%s", prefix, script_argv[i]); + xstrcat(out_buf, tmp); + } + return out_buf; } char *print_geometry(const uint16_t *geometry) -- GitLab