From 0d419fd0f5920bfbcc6e21a5db432fc6a3e32ee3 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Thu, 12 Feb 2004 18:59:17 +0000 Subject: use g_find_program_in_path to avoid fork in case program is not available 2004-02-12 Radek Doulik * em-junk-filter.c (pipe_to_sa_with_error): use g_find_program_in_path to avoid fork in case program is not available svn path=/trunk/; revision=24724 --- mail/em-junk-filter.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'mail/em-junk-filter.c') diff --git a/mail/em-junk-filter.c b/mail/em-junk-filter.c index 8e12b0efdd..ef5578e555 100644 --- a/mail/em-junk-filter.c +++ b/mail/em-junk-filter.c @@ -105,6 +105,7 @@ pipe_to_sa_with_error (CamelMimeMessage *msg, const char *in, char **argv, int r { int result, status, errnosav, fds[2]; CamelStream *stream; + char *program; pid_t pid; #if d(!)0 @@ -117,6 +118,13 @@ pipe_to_sa_with_error (CamelMimeMessage *msg, const char *in, char **argv, int r printf ("\n"); } #endif + + program = g_find_program_in_path (argv [0]); + if (program == NULL) { + d(printf ("program not found, returning %d\n", rv_err)); + return rv_err; + } + g_free (program); if (pipe (fds) == -1) { errnosav = errno; -- cgit v1.2.3