$OpenBSD: patch-bulk_mailer_c,v 1.1 2004/06/25 04:46:34 xsa Exp $ --- bulk_mailer.c.orig Wed May 24 13:34:33 2000 +++ bulk_mailer.c Fri Jun 25 00:44:11 2004 @@ -95,6 +95,8 @@ #include #include #include +#include +#include #ifdef HAVE_STRING_H #include #endif @@ -296,6 +298,7 @@ char *str; * memory, appending a NUL to the copy. */ +/* static char * strndup (str, len) char *str; @@ -307,6 +310,7 @@ int len; result[len] = '\0'; return result; } +*/ /* * sort by case-folded reversed domain @@ -337,15 +341,15 @@ char *addr; { char *at; char *ptr; - char *domain; + /* char *domain; */ char tempbuf[1024]; - char c; + /* char c; */ /* * make sure there's room in the buffer. */ if (num_addrs >= num_addr_slots) { - struct address *new; + /* struct address *new; */ num_addr_slots += 1000; if (address_list == NULL) @@ -985,7 +989,7 @@ static int copy_message (out, in) FILE *out, *in; { - int c; + /* int c; */ char linebuf[32*1024]; int has_valid_approved_hdr = 0; int has_resent_to_hdr = 0; @@ -1218,14 +1222,14 @@ FILE *out, *in; */ lines = 0; while (fgets (linebuf, sizeof (linebuf), in) != NULL) { - if (lines < 5 && + if (lines < 5 && ( /* * these often occur in English-text unsubscribe requests */ contains (linebuf, "delete me") || contains (linebuf, "remove me") || contains (linebuf, "subscribe") || - contains (linebuf, "unsubscribe")) + contains (linebuf, "unsubscribe"))) saw_command = 1; ++lines; fputs (linebuf, out); @@ -1326,13 +1330,13 @@ main (argc, argv) int argc; char *argv[]; { - int i; + /* int i; */ FILE *fp; FILE *tmp; static char template[] = "/tmp/blkXXXXXX"; char *tempname; - int c; - char buf[1024]; + /* int c; */ + /* char buf[1024]; */ while (argc > 1 && (*argv[1] == '-' || *argv[1] == '+')) { if (strcmp (argv[1], "-comment") == 0 && argc > 2) { @@ -1513,8 +1517,8 @@ char *argv[]; exit (EX_OSFILE); } - tempname = mktemp (template); - tmp = fopen (template, "w"); + tmp = fdopen (mkstemp(template), "w"); + tempname = strdup(template); switch (copy_message (tmp, stdin)) { case HAS_EMBEDDED_COMMAND: @@ -1592,4 +1596,5 @@ char *argv[]; exit (EX_OK); } + exit (EX_OK); }