Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 90770 invoked from network); 4 Jan 2004 02:34:14 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 4 Jan 2004 02:34:14 -0000 Received: (qmail 69161 invoked by uid 500); 4 Jan 2004 02:33:53 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 69095 invoked by uid 500); 4 Jan 2004 02:33:53 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 69082 invoked by uid 500); 4 Jan 2004 02:33:52 -0000 Received: (qmail 69078 invoked from network); 4 Jan 2004 02:33:52 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 4 Jan 2004 02:33:52 -0000 Received: (qmail 90713 invoked by uid 1385); 4 Jan 2004 02:34:09 -0000 Date: 4 Jan 2004 02:34:09 -0000 Message-ID: <20040104023409.90712.qmail@minotaur.apache.org> From: billbarker@apache.org To: jakarta-commons-cvs@apache.org Subject: cvs commit: jakarta-commons/daemon/src/native/nt/procrun procrun.c X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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