[gnome-desktop/wip/thumbnail-resources: 6/7] thumbnail: Parse argv manually



commit 089873e6fe9a07e9a264571c22496c43610fd26c
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Oct 1 18:06:54 2012 -0300

    thumbnail: Parse argv manually
    
    This is preliminary before we actually setrlimit.

 libgnome-desktop/gnome-desktop-thumbnail.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/libgnome-desktop/gnome-desktop-thumbnail.c b/libgnome-desktop/gnome-desktop-thumbnail.c
index 2c8da6b..34dcfd7 100644
--- a/libgnome-desktop/gnome-desktop-thumbnail.c
+++ b/libgnome-desktop/gnome-desktop-thumbnail.c
@@ -1146,6 +1146,7 @@ run_script (char *script, const char *uri, int size)
   int exit_status;
   char *expanded_script;
   char *tmpname;
+  char **argv = NULL;
   GdkPixbuf *pixbuf = NULL;
 
   fd = g_file_open_tmp (".gnome_desktop_thumbnail.XXXXXX", &tmpname, NULL);
@@ -1159,7 +1160,11 @@ run_script (char *script, const char *uri, int size)
   if (expanded_script == NULL)
     goto out;
 
-  if (!g_spawn_command_line_sync (expanded_script, NULL, NULL, &exit_status, NULL))
+  if (!g_shell_parse_argv (expanded_script, NULL, &argv, NULL))
+    goto out;
+
+  if (!g_spawn_sync (NULL, argv, NULL, G_SPAWN_SEARCH_PATH,
+                     NULL, NULL, NULL, NULL, &exit_status, NULL))
     goto out;
 
   if (exit_status != 0)
@@ -1171,6 +1176,7 @@ run_script (char *script, const char *uri, int size)
   g_free (expanded_script);
   g_unlink (tmpname);
   g_free (tmpname);
+  g_strfreev (argv);
 
   return pixbuf;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]