aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mailtrain.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/mailtrain.c b/mailtrain.c
index 41071bc..5529f03 100644
--- a/mailtrain.c
+++ b/mailtrain.c
@@ -71,7 +71,7 @@ static int run_sendmail(int mailfd, enum classification wanted)
} else {
char **argv;
int sz = sizeof(char *) * (2 + extra_args_num + 1);
- int i;
+ int i, fd;
argv = i_malloc(sz);
memset(argv, 0, sz);
@@ -84,8 +84,10 @@ static int run_sendmail(int mailfd, enum classification wanted)
argv[i + 1] = (char *) dest;
dup2(mailfd, 0);
- close(1);
- close(2);
+ fd = open("/dev/null", O_WRONLY);
+ dup2(fd, 1);
+ dup2(fd, 2);
+ close(fd);
execv(sendmail_binary, argv);
_exit(1);
/* not reached */