[Xfce4-commits] r29679 - in libexo/trunk: . exo-open

Nick Schermer nick at xfce.org
Sun Mar 22 10:09:16 CET 2009


Author: nick
Date: 2009-03-22 09:09:16 +0000 (Sun, 22 Mar 2009)
New Revision: 29679

Modified:
   libexo/trunk/NEWS
   libexo/trunk/configure.in.in
   libexo/trunk/exo-open/main.c
Log:
Quote arguments passed to exo-open (bug #5132).


Modified: libexo/trunk/NEWS
===================================================================
--- libexo/trunk/NEWS	2009-03-20 06:27:59 UTC (rev 29678)
+++ libexo/trunk/NEWS	2009-03-22 09:09:16 UTC (rev 29679)
@@ -1,3 +1,7 @@
+0.3.xxx
+=======
+- Quote arguments passed to exo-open (bug #5132).
+
 0.3.100
 =======
 - Updated translations: ro (Mișu Moldovan), el (Stavros Giannouris), 

Modified: libexo/trunk/configure.in.in
===================================================================
--- libexo/trunk/configure.in.in	2009-03-20 06:27:59 UTC (rev 29678)
+++ libexo/trunk/configure.in.in	2009-03-22 09:09:16 UTC (rev 29679)
@@ -15,7 +15,7 @@
 m4_define([libexo_version_micro], [100])
 m4_define([libexo_version_nano], [])
 m4_define([libexo_version_build], [r at REVISION@])
-m4_define([libexo_version_tag], [])
+m4_define([libexo_version_tag], [svn])
 m4_define([libexo_version], [libexo_version_major().libexo_version_minor().libexo_version_micro()ifelse(libexo_version_nano(), [], [], [.libexo_version_nano()])ifelse(libexo_version_tag(), [svn], [libexo_version_tag()-libexo_version_build()], [libexo_version_tag()])])
 
 dnl ********************************************

Modified: libexo/trunk/exo-open/main.c
===================================================================
--- libexo/trunk/exo-open/main.c	2009-03-20 06:27:59 UTC (rev 29678)
+++ libexo/trunk/exo-open/main.c	2009-03-22 09:09:16 UTC (rev 29679)
@@ -95,8 +95,10 @@
   GOptionContext *context;
   GtkWidget      *dialog;
   GError         *err = NULL;
-  gchar          *parameter;
+  gchar          *parameter, *quoted;
   gint            result = EXIT_SUCCESS;
+  GString        *join;
+  guint           i;
 
 #ifdef GETTEXT_PACKAGE
   /* setup i18n support */
@@ -138,9 +140,28 @@
     }
   else if (G_LIKELY (opt_launch != NULL))
     {
-      /* combine all specified parameters to one parameter string */
-      parameter = (argc > 1) ? g_strjoinv (" ", argv + 1) : NULL;
+      if (argc > 1)
+        {
+          /* combine all specified parameters to one parameter string */
+          join = g_string_new (NULL);
+          for (i = 1; argv[i] != NULL; i++)
+            {
+              /* separate the arguments */
+              if (i > 1)
+                join = g_string_append_c (join, ' ');
 
+              /* append the quoted argument */
+              quoted = g_shell_quote (argv[i]);
+              join = g_string_append (join, quoted);
+              g_free (quoted);
+            }
+          parameter = g_string_free (join, FALSE);
+        }
+      else
+        {
+          parameter = NULL;
+        }
+
       /* run the preferred application */
       if (!exo_execute_preferred_application (opt_launch, parameter, opt_working_directory, NULL, &err))
         {




More information about the Xfce4-commits mailing list