diff options
author | Susan LoVerso <sue@mongodb.com> | 2016-02-11 15:48:35 -0500 |
---|---|---|
committer | Susan LoVerso <sue@mongodb.com> | 2016-02-11 15:48:35 -0500 |
commit | 58f9466e02fea96279a919078e3b3fba9a2d8cc8 (patch) | |
tree | 9459a2807c9996f641dafdb52b9ffe6096be014a | |
parent | 1d081b431605026d3c8e45f5269ad4ba17b4e86e (diff) | |
download | mongo-58f9466e02fea96279a919078e3b3fba9a2d8cc8.tar.gz |
WT-2349 Fix argv[0] usage for system command.
-rw-r--r-- | test/readonly/readonly.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test/readonly/readonly.c b/test/readonly/readonly.c index a289296ea65..f4ad27991e5 100644 --- a/test/readonly/readonly.c +++ b/test/readonly/readonly.c @@ -45,6 +45,7 @@ static char home[HOME_SIZE]; /* Program working dir */ static char home_rd[HOME_SIZE]; /* Read-only dir */ static char home_rd2[HOME_SIZE]; /* Read-only dir */ static const char *progname; /* Program name */ +static const char *saved_argv0; /* Program name */ static const char *uri = "table:main"; #define ENV_CONFIG \ @@ -141,6 +142,10 @@ main(int argc, char *argv[]) progname = argv[0]; else ++progname; + /* + * Needed unaltered for system command later. + */ + saved_argv0 = argv[0]; working_dir = "WT_RD"; child = false; @@ -254,7 +259,7 @@ main(int argc, char *argv[]) * the child even though it should not be. So use 'system' to spawn * an entirely new process. */ - (void)snprintf(cmd, sizeof(cmd), "%s -C", progname); + (void)snprintf(cmd, sizeof(cmd), "%s -C", saved_argv0); if ((status = system(cmd)) < 0) testutil_die(status, "system"); |