diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-07-25 14:04:55 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-07-25 14:04:55 +0800 |
commit | d60d21300924fad507d812edca3de30074b52e02 (patch) | |
tree | b57203798c6b61446d409149803bc9ec8629a73e /camel | |
parent | e6623c2d8205df0368d34c22260e0046793a25b2 (diff) | |
download | gsoc2013-evolution-d60d21300924fad507d812edca3de30074b52e02.tar gsoc2013-evolution-d60d21300924fad507d812edca3de30074b52e02.tar.gz gsoc2013-evolution-d60d21300924fad507d812edca3de30074b52e02.tar.bz2 gsoc2013-evolution-d60d21300924fad507d812edca3de30074b52e02.tar.lz gsoc2013-evolution-d60d21300924fad507d812edca3de30074b52e02.tar.xz gsoc2013-evolution-d60d21300924fad507d812edca3de30074b52e02.tar.zst gsoc2013-evolution-d60d21300924fad507d812edca3de30074b52e02.zip |
Use execv ("sh", "-c", command) rather than execing the command directly.
2002-07-25 Jeffrey Stedfast <fejj@ximian.com>
* camel-filter-search.c (run_command): Use execv ("sh", "-c",
command) rather than execing the command directly.
svn path=/trunk/; revision=17582
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 5 | ||||
-rw-r--r-- | camel/camel-filter-search.c | 15 |
2 files changed, 9 insertions, 11 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index a52716f7ed..12ab8454cf 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,8 @@ +2002-07-25 Jeffrey Stedfast <fejj@ximian.com> + + * camel-filter-search.c (run_command): Use execv ("sh", "-c", + command) rather than execing the command directly. + 2002-07-25 Not Zed <NotZed@Ximian.com> * camel-folder-summary.c (camel_folder_summary_save): When writing diff --git a/camel/camel-filter-search.c b/camel/camel-filter-search.c index 9475f3ad57..3bcb582fba 100644 --- a/camel/camel-filter-search.c +++ b/camel/camel-filter-search.c @@ -503,6 +503,9 @@ run_command (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessa int in_fds[2]; pid_t pid; + if (argc < 1 || argv[0]->value.string[0] == '\0') + return 0; + if (pipe (in_fds) == -1) { camel_exception_setv (fms->ex, CAMEL_EXCEPTION_SYSTEM, _("Failed to create pipe to '%s': %s"), @@ -512,7 +515,6 @@ run_command (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessa if (!(pid = fork ())) { /* child process */ - GPtrArray *args; int maxfd, i; if (dup2 (in_fds[0], STDIN_FILENO) < 0) @@ -528,16 +530,7 @@ run_command (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessa } } - args = g_ptr_array_new (); - g_ptr_array_add (args, g_basename (argv[0]->value.string)); - for (i = 1; i < argc; i++) { - g_ptr_array_add (args, argv[i]->value.string); - } - g_ptr_array_add (args, NULL); - - execvp (argv[0]->value.string, (char **) args->pdata); - - g_ptr_array_free (args, TRUE); + execv ("sh", "-c", argv[0]->value.string); fprintf (stderr, "Could not execute %s: %s\n", argv[0]->value.string, g_strerror (errno)); |