aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-filter-search.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/camel-filter-search.c')
-rw-r--r--camel/camel-filter-search.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/camel/camel-filter-search.c b/camel/camel-filter-search.c
index 627b7ad78b..62747dcf17 100644
--- a/camel/camel-filter-search.c
+++ b/camel/camel-filter-search.c
@@ -42,10 +42,15 @@
#include <signal.h>
#include <sys/wait.h>
-#include <e-util/e-sexp.h>
+
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
#include <gal/util/e-iconv.h>
+#include "e-util/e-sexp.h"
+
#include "camel-mime-message.h"
#include "camel-provider.h"
#include "camel-session.h"
@@ -162,10 +167,8 @@ check_header (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMess
type = CAMEL_SEARCH_TYPE_ADDRESS_ENCODED;
else {
ct = camel_mime_part_get_content_type (CAMEL_MIME_PART (message));
- if (ct) {
- charset = header_content_type_param (ct, "charset");
- charset = e_iconv_charset_name (charset);
- }
+ if (ct)
+ charset = e_iconv_charset_name(header_content_type_param(ct, "charset"));
}
}
@@ -516,22 +519,18 @@ run_command (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessa
if (!(pid = fork ())) {
/* child process */
GPtrArray *args;
- int maxfd, fd, i;
-
- fd = open ("/dev/null", O_WRONLY);
+ int maxfd, i;
- if (dup2 (in_fds[0], STDIN_FILENO) < 0 ||
- dup2 (fd, STDOUT_FILENO) < 0 ||
- dup2 (fd, STDERR_FILENO) < 0)
+ if (dup2 (in_fds[0], STDIN_FILENO) < 0)
_exit (255);
setsid ();
maxfd = sysconf (_SC_OPEN_MAX);
if (maxfd > 0) {
- for (fd = 0; fd < maxfd; fd++) {
- if (fd != STDIN_FILENO && fd != STDOUT_FILENO && fd != STDERR_FILENO)
- close (fd);
+ for (i = 0; i < maxfd; i++) {
+ if (i != STDIN_FILENO && i != STDOUT_FILENO && i != STDERR_FILENO)
+ close (i);
}
}
@@ -548,7 +547,7 @@ run_command (struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterMessa
_exit (255);
} else if (pid < 0) {
camel_exception_setv (fms->ex, CAMEL_EXCEPTION_SYSTEM,
- _("Failed to create create child process '%s': %s"),
+ _("Failed to create child process '%s': %s"),
argv[0]->value.string, g_strerror (errno));
return -1;
}