[Commits] action.c 1.12.2.79 1.12.2.80

colin at claws-mail.org colin at claws-mail.org
Thu Dec 20 10:23:46 CET 2012


Update of /home/claws-mail/claws/src
In directory srv:/tmp/cvs-serv14190/src

Modified Files:
      Tag: gtk2
	action.c 
Log Message:
2012-12-20 [colin]	3.9.0cvs51

	* src/action.c
		Fix crash on action error;
		Fix trimming of leading spaces in actions

Index: action.c
===================================================================
RCS file: /home/claws-mail/claws/src/action.c,v
retrieving revision 1.12.2.79
retrieving revision 1.12.2.80
diff -u -d -r1.12.2.79 -r1.12.2.80
--- action.c	12 Dec 2012 16:40:53 -0000	1.12.2.79
+++ action.c	20 Dec 2012 09:23:44 -0000	1.12.2.80
@@ -925,7 +925,7 @@
 			     Children *children)
 {
 	gint chld_in, chld_out, chld_err;
-	gchar **argv, *ret_str;
+	gchar **argv, *ret_str, *trim_cmd;
 	GPid pid;
 	ChildInfo *child_info;
 	gint follow_child;
@@ -940,10 +940,15 @@
 	ret_str = g_locale_from_utf8(cmd, strlen(cmd),
 				     &by_read, &by_written,
 				     NULL);
-	if (ret_str && by_written)
-		argv = strsplit_with_quote(ret_str, " ", 0);
-	else
-		argv = strsplit_with_quote(cmd, " ", 0);
+	if (!ret_str || !by_written)
+		ret_str = g_strdup(cmd);
+
+	trim_cmd = ret_str;
+
+	while (g_ascii_isspace(trim_cmd[0]))
+		trim_cmd++;
+
+	argv = strsplit_with_quote(trim_cmd, " ", 0);
 
 	g_free(ret_str);
 
@@ -965,8 +970,9 @@
 	if (!result) {
 		alertpanel_error(_("Could not fork to execute the following "
 				"command:\n%s\n%s"),
-				 cmd, error->message);
-		g_free(error);
+				 cmd, error ? error->message : _("Unknown error"));
+		if (error)
+			g_error_free(error);
 		return NULL;
 	}
 



More information about the Commits mailing list