diff options
author | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-12-21 14:54:11 -0800 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2008-12-21 21:35:33 -0800 |
commit | 8f04a5237384fa97ff960b4607a79b688ea03fc1 (patch) | |
tree | 44eb21e4b333eacfde32a1155ec23f1bcbee8fb6 /hw/xquartz/X11Controller.m | |
parent | 029d255a654eca6401c374d145f63bbb923554b5 (diff) |
XQuartz: Run applications via '/bin/sh -c ...' to support users who expect shell parsing
(cherry picked from commit 67455e716e3ecffd528930479192785958d37988)
Diffstat (limited to 'hw/xquartz/X11Controller.m')
-rw-r--r-- | hw/xquartz/X11Controller.m | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/hw/xquartz/X11Controller.m b/hw/xquartz/X11Controller.m index 7222f463b..9b30fa6bb 100644 --- a/hw/xquartz/X11Controller.m +++ b/hw/xquartz/X11Controller.m @@ -314,36 +314,16 @@ BOOL xquartz_resetenv_display = NO; - (void) launch_client:(NSString *)filename { - const char *command = [filename UTF8String]; int child1, child2 = 0; int status; - char newcommand[1024]; - char *newargv[1024]; + const char *newargv[4]; char buf[128]; - size_t newargc; char *s; - if(strlen(command) > 1023) { - fprintf(stderr, "Error: command is too long: %s\n", command); - return; - } - - strlcpy(newcommand, command, 1024); - - for(newargc=0, s=newcommand; *s; newargc++) { - for(; *s && *s == ' '; s++); - if(!*s) - break; - - newargv[newargc] = s; - for(; *s && *s != ' '; s++); - - if(*s) { - *s='\0'; - s++; - } - } - newargv[newargc] = NULL; + newargv[0] = [X11App prefs_get_string:@PREFS_LOGIN_SHELL default:"/bin/sh"]; + newargv[1] = "-c"; + newargv[2] = [filename UTF8String]; + newargv[3] = NULL; s = getenv("DISPLAY"); if (xquartz_resetenv_display || s == NULL || s[0] == 0) { |