2012-12-20 [colin] 3.9.0cvs51
authorColin Leroy <colin@colino.net>
Thu, 20 Dec 2012 09:23:45 +0000 (09:23 +0000)
committerColin Leroy <colin@colino.net>
Thu, 20 Dec 2012 09:23:45 +0000 (09:23 +0000)
* src/action.c
Fix crash on action error;
Fix trimming of leading spaces in actions

ChangeLog
PATCHSETS
configure.ac
src/action.c

index 303983253224f6dec429ef3924c35aff218be228..c21acdc8d3280213cccbb11911390c8a7ca4219b 100644 (file)
--- 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
index f63a5f0befedbe3aa44065ae6e6f7d125d9b1ef6..b129066fd2cd965c27c6b4e4f385c8484fe9cb48 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( 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
index 1e7b49d9c7855d0a0f6657bd777861eee54c09e6..89281c83de72c10697a48ae0aeff4b60045ceec5 100644 (file)
@@ -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=
 
index cc26bdfe32a84ed5aeec0f5a6ce5fbb3ae9be945..669f32596a19d2c97aa56f067e3d0ee7e6b9ba93 100644 (file)
@@ -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;
        }