Shell quote argv[0] before spawning a process

The path to the executable may contain spaces.
This commit is contained in:
Christian Dywan 2010-10-03 07:14:00 +02:00
parent 9a0e2bffef
commit b6247e3314

View file

@ -2139,7 +2139,12 @@ static void
midori_browser_spawn_app (const gchar* uri) midori_browser_spawn_app (const gchar* uri)
{ {
const gchar* executable = sokoke_get_argv (NULL)[0]; const gchar* executable = sokoke_get_argv (NULL)[0];
gchar* command = g_strconcat (executable, " -a", NULL); /* "midori"
"/usr/bin/midori"
"c:/Program Files/Midori/bin/midori.exe" */
gchar* quoted = g_shell_quote (executable);
gchar* command = g_strconcat (quoted, " -a", NULL);
g_free (quoted);
sokoke_spawn_program (command, uri, FALSE); sokoke_spawn_program (command, uri, FALSE);
g_free (command); g_free (command);
} }