diff options
author | wtc%netscape.com <devnull@localhost> | 2002-10-31 05:00:01 +0000 |
---|---|---|
committer | wtc%netscape.com <devnull@localhost> | 2002-10-31 05:00:01 +0000 |
commit | 408b9491773ee3d4af2a803a43ef5cb12707b547 (patch) | |
tree | e419937921f2a9afc0a7fdb9e20207a463b875cc | |
parent | eb842bf8920c0891e14354a9161cf0d78fc60ee5 (diff) | |
download | nspr-hg-408b9491773ee3d4af2a803a43ef5cb12707b547.tar.gz |
Bug 176543: handle the case of invoking a program wit no arguments. The
command line should be an empty string in that case. Initialize newEnvp.
The patch is contributed by Michael Kaply <mkaply@us.ibm.com>.
-rw-r--r-- | pr/src/md/os2/os2misc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pr/src/md/os2/os2misc.c b/pr/src/md/os2/os2misc.c index 250972af..b3afa53d 100644 --- a/pr/src/md/os2/os2misc.c +++ b/pr/src/md/os2/os2misc.c @@ -123,9 +123,9 @@ static int assembleCmdLine(char *const *argv, char **cmdLine) /* * Find out how large the command line buffer should be. */ - cmdLineSize = 0; + cmdLineSize = 1; /* final null */ for (arg = argv+1; *arg; arg++) { - cmdLineSize += strlen(*arg) + 1; /* space in between, or final null */ + cmdLineSize += strlen(*arg) + 1; /* space in between */ } *cmdLine = PR_MALLOC(cmdLineSize); if (*cmdLine == NULL) { @@ -238,7 +238,7 @@ PRProcess * _PR_CreateOS2Process( { PRProcess *proc = NULL; char *cmdLine = NULL; - char **newEnvp; + char **newEnvp = NULL; char *envBlock = NULL; STARTDATA startData = {0}; |