Quote when needed and don't try stuff that doesn't work under Windows.
This commit is contained in:
parent
b4c913aaa9
commit
7f05445047
1 changed files with 10 additions and 8 deletions
|
@ -17,7 +17,7 @@
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
$Id: process.c,v 1.1.2.66 2003/08/08 17:17:13 guus Exp $
|
$Id: process.c,v 1.1.2.67 2003/08/08 19:43:47 guus Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
@ -99,10 +99,8 @@ bool install_service(void) {
|
||||||
|
|
||||||
strncat(command, program_name, sizeof(command));
|
strncat(command, program_name, sizeof(command));
|
||||||
for(argp = g_argv + 1; *argp; argp++) {
|
for(argp = g_argv + 1; *argp; argp++) {
|
||||||
space = strchr(*argp, " ");
|
space = strchr(*argp, ' ');
|
||||||
strncat(command, " ", sizeof(command));
|
strncat(command, space?" \"":" ", sizeof(command));
|
||||||
if(space)
|
|
||||||
strncat(command, "\"", sizeof(command));
|
|
||||||
strncat(command, *argp, sizeof(command));
|
strncat(command, *argp, sizeof(command));
|
||||||
if(space)
|
if(space)
|
||||||
strncat(command, "\"", sizeof(command));
|
strncat(command, "\"", sizeof(command));
|
||||||
|
@ -363,26 +361,29 @@ bool execute_script(const char *name, char **envp)
|
||||||
|
|
||||||
cp();
|
cp();
|
||||||
|
|
||||||
asprintf(&scriptname, "%s/%s", confbase, name);
|
asprintf(&scriptname, "\"%s/%s\"", confbase, name);
|
||||||
|
|
||||||
|
#ifndef HAVE_MINGW
|
||||||
/* First check if there is a script */
|
/* First check if there is a script */
|
||||||
|
|
||||||
if(stat(scriptname, &s))
|
if(stat(scriptname, &s))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
ifdebug(STATUS) logger(LOG_INFO, _("Executing script %s"), name);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Set environment */
|
/* Set environment */
|
||||||
|
|
||||||
while(*envp)
|
while(*envp)
|
||||||
putenv(*envp++);
|
putenv(*envp++);
|
||||||
|
|
||||||
ifdebug(STATUS) logger(LOG_INFO, _("Executing script %s"), name);
|
|
||||||
|
|
||||||
status = system(scriptname);
|
status = system(scriptname);
|
||||||
|
|
||||||
free(scriptname);
|
free(scriptname);
|
||||||
|
|
||||||
/* Unset environment? */
|
/* Unset environment? */
|
||||||
|
|
||||||
|
#ifdef WEXITSTATUS
|
||||||
if(status != -1) {
|
if(status != -1) {
|
||||||
if(WIFEXITED(status)) { /* Child exited by itself */
|
if(WIFEXITED(status)) { /* Child exited by itself */
|
||||||
if(WEXITSTATUS(status)) {
|
if(WEXITSTATUS(status)) {
|
||||||
|
@ -404,6 +405,7 @@ bool execute_script(const char *name, char **envp)
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue