commit c07c1903f25df93935ede977b344694eb7c2587c
parent 7df8c38d7938e2ea33f9b056cf0d1bdb8d04cf31
Author: Colin Leroy <colin@colino.net>
Date: Thu, 20 Dec 2012 09:23:45 +0000
2012-12-20 [colin] 3.9.0cvs51
* src/action.c
Fix crash on action error;
Fix trimming of leading spaces in actions
Diffstat:
4 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,9 @@
+2012-12-20 [colin] 3.9.0cvs51
+
+ * src/action.c
+ Fix crash on action error;
+ Fix trimming of leading spaces in actions
+
2012-12-19 [colin] 3.9.0cvs50
* src/editldap.c
diff --git a/PATCHSETS b/PATCHSETS
@@ -4548,3 +4548,4 @@
( cvs diff -u -r 1.3.2.13 -r 1.3.2.14 src/addrselect.c; ) > 3.9.0cvs48.patchset
( cvs diff -u -r 1.94.2.241 -r 1.94.2.242 src/messageview.c; ) > 3.9.0cvs49.patchset
( cvs diff -u -r 1.8.2.47 -r 1.8.2.48 src/editldap.c; cvs diff -u -r 1.2.2.26 -r 1.2.2.27 src/ldapctrl.c; cvs diff -u -r 1.4.2.25 -r 1.4.2.26 src/ldapserver.c; ) > 3.9.0cvs50.patchset
+( cvs diff -u -r 1.12.2.79 -r 1.12.2.80 src/action.c; ) > 3.9.0cvs51.patchset
diff --git a/configure.ac b/configure.ac
@@ -12,7 +12,7 @@ MINOR_VERSION=9
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=50
+EXTRA_VERSION=51
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
diff --git a/src/action.c b/src/action.c
@@ -925,7 +925,7 @@ static ChildInfo *fork_child(gchar *cmd, const gchar *msg_str,
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 @@ static ChildInfo *fork_child(gchar *cmd, const gchar *msg_str,
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 @@ static ChildInfo *fork_child(gchar *cmd, const gchar *msg_str,
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;
}