[beast/win32: 30/44] Escape command string before executing to allow \ within file names.



commit 469f181a626df3a30e0ec19148c954b2a90a6066
Author: Stefan Westerfeld <stefan space twc de>
Date:   Sat Sep 5 09:49:53 2009 +0200

    Escape command string before executing to allow \ within file names.
    
    Based on 010_plugin_ext_crawler.diff.

 sfi/sfidl-corecxx.cc |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/sfi/sfidl-corecxx.cc b/sfi/sfidl-corecxx.cc
index 23d282e..de4396c 100644
--- a/sfi/sfidl-corecxx.cc
+++ b/sfi/sfidl-corecxx.cc
@@ -1362,8 +1362,8 @@ public:
         g_print ("{\n");
         gint estatus = 0;
         GError *error = NULL;
-        gchar *out, *err = NULL;
-        String cmd = String() + "gdk-pixbuf-csource " + "--name=local_pixstream " + ii->file;
+        gchar *out, *err = NULL, *escaped = g_strescape (ii->file.c_str(), 0);
+        String cmd = String() + "gdk-pixbuf-csource " + "--name=local_pixstream " + escaped;
         g_spawn_command_line_sync (cmd.c_str(), &out, &err, &estatus, &error);
         if (err && *err)
           g_printerr ("gdk-pixbuf-csource: %s", err);
@@ -1374,6 +1374,7 @@ public:
                           ii->file.c_str(), error ? ':' : ' ', error->message);
             exit (estatus & 255 ? estatus : 1);
           }
+        g_free (escaped);
         g_clear_error (&error);
         g_free (err);
         g_print ("  %s\n", out);



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