[OS/2] Bug 333639: Add note about assembleCmdLine() usage and fix build warnings in _PR_CreateOS2Process(), r=wtchang, sr=mkaply NSPRPUB_PRE_4_2_CLIENT_BRANCH
authormozilla%weilbacher.org
Thu, 05 Oct 2006 12:27:07 +0000
branchNSPRPUB_PRE_4_2_CLIENT_BRANCH
changeset 3704 18328832d0b12d2a56a2a84032659093e8157b1d
parent 3699 00f1eb3e38f7c877fb5b2b10aa693686da225e9f (current diff)
parent 3701 50fc4db7a6f20f35495a0d8e021a829c8d469f56 (diff)
child 3707 22bdfa5f33a6a119b077eea17ad28019455229d5
push idunknown
push userunknown
push dateunknown
reviewerswtchang, mkaply
bugs333639
[OS/2] Bug 333639: Add note about assembleCmdLine() usage and fix build warnings in _PR_CreateOS2Process(), r=wtchang, sr=mkaply
pr/src/md/os2/os2misc.c
--- a/pr/src/md/os2/os2misc.c
+++ b/pr/src/md/os2/os2misc.c
@@ -111,16 +111,20 @@ PR_Now(void)
  * Process creation routines
  *
  ***********************************************************************
  ***********************************************************************
  */
 
 /*
  * Assemble the command line by concatenating the argv array.
+ * Special characters intentionally do not get escaped, and it is
+ * expected that the caller wraps arguments in quotes if needed
+ * (e.g. for filename with spaces).
+ *
  * On success, this function returns 0 and the resulting command
  * line is returned in *cmdLine.  On failure, it returns -1.
  */
 static int assembleCmdLine(char *const *argv, char **cmdLine)
 {
     char *const *arg;
     int cmdLineSize;
 
@@ -244,17 +248,16 @@ PRProcess * _PR_CreateOS2Process(
     char *cmdLine = NULL;
     char **newEnvp = NULL;
     char *envBlock = NULL;
    
     STARTDATA startData = {0};
     APIRET    rc;
     ULONG     ulAppType = 0;
     PID       pid = 0;
-    char     *pEnvWPS = NULL;
     char     *pszComSpec;
     char      pszEXEName[CCHMAXPATH] = "";
     char      pszFormatString[CCHMAXPATH];
     char      pszObjectBuffer[CCHMAXPATH];
     char     *pszFormatResult = NULL;
 
     /*
      * Variables for DosExecPgm
@@ -300,17 +303,17 @@ PRProcess * _PR_CreateOS2Process(
     }
   
     rc = DosQueryAppType(path, &ulAppType);
     if (rc != NO_ERROR) {
        char *pszDot = strrchr(path, '.');
        if (pszDot) {
           /* If it is a CMD file, launch the users command processor */
           if (!stricmp(pszDot, ".cmd")) {
-             rc = DosScanEnv("COMSPEC", &pszComSpec);
+             rc = DosScanEnv("COMSPEC", (PSZ *)&pszComSpec);
              if (!rc) {
                 strcpy(pszFormatString, "/C %s %s");
                 strcpy(pszEXEName, pszComSpec);
                 ulAppType = FAPPTYP_WINDOWCOMPAT;
              }
           }
        }
     }