[Xfce4-commits] <xfce4-smartbookmark-plugin:master> Fix broken argument handling (bug #8642)
Landry Breuil
noreply at xfce.org
Thu Jan 3 22:28:01 CET 2013
Updating branch refs/heads/master
to d077cd1dfa46cb6d736bedf172f33d51e1fed334 (commit)
from 860c500cf991c0d64f1538abf39c7579bad4a9ed (commit)
commit d077cd1dfa46cb6d736bedf172f33d51e1fed334
Author: Landry Breuil <landry at xfce.org>
Date: Thu Jan 3 22:22:27 2013 +0100
Fix broken argument handling (bug #8642)
Use g_spawn_async() instead of building a commandline and passing it
to g_spawn_command_line_async() which will in turn use g_shell_parse_argv()..
Fix some corner cases with some special chars interpreted by the shell.
Mostly from Guido Berhoerster, thanks!
src/smartbookmark.c | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/src/smartbookmark.c b/src/smartbookmark.c
index b78d014..6f358d3 100644
--- a/src/smartbookmark.c
+++ b/src/smartbookmark.c
@@ -76,14 +76,21 @@ XFCE_PANEL_PLUGIN_REGISTER(smartbookmark_construct);
static gboolean do_search(const char *url, const char *keyword)
{
DBG ("Do search");
- gchar *execute;
+ gchar *argv[] = { "exo-open", "--launch", "WebBrowser", NULL, NULL };
+ GError *error = NULL;
+ gchar *complete_url;
gboolean success;
- execute = g_strconcat("exo-open --launch WebBrowser \"", url, NULL);
- execute = g_strconcat(execute, keyword, NULL);
- execute = g_strconcat(execute, "\"", NULL);
+ complete_url = g_strconcat(url, keyword, NULL);
+ argv[3] = complete_url;
- success = g_spawn_command_line_async(execute, NULL);
- g_free(execute);
+ success = g_spawn_async(NULL, (gchar **)argv, NULL,
+ G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, NULL, &error);
+
+ if (!success) {
+ xfce_dialog_show_error(NULL, error, _("Failed to send %s to your preferred browser"), complete_url);
+ g_error_free(error);
+ }
+ g_free(complete_url);
return success;
}
More information about the Xfce4-commits
mailing list