changeset 16906:64b7d4ebd2b2

Escape filename when using the command sound method. Fixes ticket #607.
author Casey Harkins <charkins@pidgin.im>
date Sat, 05 May 2007 02:19:19 +0000
parents aa87ecd650d2
children ff85eb760c7d
files pidgin/gtksound.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtksound.c	Sat May 05 01:58:20 2007 +0000
+++ b/pidgin/gtksound.c	Sat May 05 02:19:19 2007 +0000
@@ -418,6 +418,7 @@
 	if (!strcmp(method, "custom")) {
 		const char *sound_cmd;
 		char *command;
+		char *esc_filename;
 		GError *error = NULL;
 
 		sound_cmd = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/sound/command");
@@ -429,16 +430,19 @@
 			return;
 		}
 
+		esc_filename = g_strdup_printf("'%s'", filename);
+
 		if(strstr(sound_cmd, "%s"))
-			command = purple_strreplace(sound_cmd, "%s", filename);
+			command = purple_strreplace(sound_cmd, "%s", esc_filename);
 		else
-			command = g_strdup_printf("%s %s", sound_cmd, filename);
+			command = g_strdup_printf("%s %s", sound_cmd, esc_filename);
 
 		if(!g_spawn_command_line_async(command, &error)) {
 			purple_debug_error("gtksound", "sound command could not be launched: %s\n", error->message);
 			g_error_free(error);
 		}
 
+		g_free(esc_filename);
 		g_free(command);
 		return;
 	}