commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From billbar...@apache.org
Subject cvs commit: jakarta-commons/daemon/src/native/nt/procrun procrun.c
Date Sun, 04 Jan 2004 02:34:09 GMT
billbarker    2004/01/03 18:34:09

  Modified:    daemon/src/native/nt/procrun procrun.c
  Log:
  Allow spaces in the service-name.
  
  Yes, pretty silly, but Windows users love spaces :).
  
  Fix for bug #24936
  Reported By: Patrick Samson p_samson@yahoo.com
  
  Revision  Changes    Path
  1.12      +22 -2     jakarta-commons/daemon/src/native/nt/procrun/procrun.c
  
  Index: procrun.c
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/daemon/src/native/nt/procrun/procrun.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- procrun.c	31 Dec 2003 04:43:15 -0000	1.11
  +++ procrun.c	4 Jan 2004 02:34:09 -0000	1.12
  @@ -1991,7 +1991,7 @@
   {
       int arglen = 0;
       char *argp;
  -    int i,n;
  +    int i,n, sp;
   
       /* parse command line */
       *java = NULL;
  @@ -2001,7 +2001,14 @@
           return -1;
       } 
       strcat(path, " " PROC_ARG_RUN_SERVICE);
  +    sp = strchr(proc->service.name, ' ') != NULL;
  +    if(sp) {
  +        strcat(path,"\"");
  +    }
       strcat(path, proc->service.name); 
  +    if(sp) {
  +        strcat(path,"\"");
  +    }
       for (i = 2; i < argc; i++) {
           DBPRINTF2("Parsing %d [%s]\n", i, argv[i]);
           if (strlen(argv[i]) > 2 && argv[i][0] == '-' && argv[i][1] ==
'-') {
  @@ -2044,7 +2051,13 @@
               else if (STRNI_COMPARE(argp, PROCRUN_PARAMS_INSTALL)) {
                   strcpy(path, argv[++i]); 
                   strcat(path, " " PROC_ARG_RUN_SERVICE);
  +                if(sp) {
  +                    strcat(path,"\"");
  +                }
                   strcat(path, proc->service.name);
  +                if(sp) {
  +                    strcat(path, "\"");
  +                }
               }
               else if (STRNI_COMPARE(argp, PROCRUN_PARAMS_ENVIRONMENT)) {
                 proc->service.environment = pool_strdup(proc->pool, argv[++i]);
  @@ -2332,7 +2345,7 @@
       char *argp;
       char path[MAX_PATH+1];
       char *java = NULL;
  -    int arglen = 0;
  +    int arglen = 0, sp;
   
       int i, n;
       if (!proc->service.name) {
  @@ -2343,8 +2356,15 @@
           DBPRINTF0(NULL);
           return -1;
       }
  +    sp = strchr(proc->service.name, ' ') != NULL;
       strcat(path, " " PROC_ARG_RUN_SERVICE);
  +    if(sp) {
  +        strcat(path,"\"");
  +    }
       strcat(path, proc->service.name);
  +    if(sp) {
  +        strcat(path, "\"");
  +    }
       DBPRINTF1("Updating service %s\n", path);
   
       manager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message