# HG changeset patch # User mortenp # Date 1082639753 -36000 # Node ID f54f95a4c53e695e6448ddc4968682983a18ad9b # Parent b045203f558b40d001aeff114a4803ceb46cc0c2 changed to use log_error() all over diff -r b045203f558b -r f54f95a4c53e src/incindexfile.c --- a/src/incindexfile.c Thu Apr 22 23:00:27 2004 +1000 +++ b/src/incindexfile.c Thu Apr 22 23:15:53 2004 +1000 @@ -19,6 +19,8 @@ #include "incindexfile.h" #include "itoa.h" +#include "log_error.c" + #define INTBUF_SIZE 32 int incindexfile(const char *listdir, int incflag) @@ -39,14 +41,14 @@ fd = open(indexfilename, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); if(fd == -1) { - perror("Error opening index file:"); + log_error("Error opening index file"); exit(EXIT_FAILURE); } lock = myexcllock(fd); if(lock) { - perror("Error locking index file:"); + log_error("Error locking index file"); close(fd); exit(EXIT_FAILURE); } diff -r b045203f558b -r f54f95a4c53e src/listcontrol.c --- a/src/listcontrol.c Thu Apr 22 23:00:27 2004 +1000 +++ b/src/listcontrol.c Thu Apr 22 23:15:53 2004 +1000 @@ -61,8 +61,7 @@ "-L", listdir, "-a", fromemails.emaillist[0], "-C", 0); - fprintf(stderr, "%s:%d execlp() of "BINDIR"mlmmj-subscribe failed: ", __FILE__, __LINE__); - perror(NULL); + log_error("execlp() of "BINDIR"mlmmj-subscribe failed"); exit(EXIT_FAILURE); } else /* Not a valid From: address, so we silently ignore */ exit(EXIT_SUCCESS); @@ -78,12 +77,13 @@ if(strncasecmp(tmpstr, fromemails.emaillist[0], strlen(tmpstr)) == 0) { unlink(conffilename); - execlp(BINDIR"mlmmj-subscribe", "mlmmj-subscribe", + execlp(BINDIR"mlmmj-subscribe", + "mlmmj-subscribe", "-L", listdir, "-a", tmpstr, "-c", 0); - fprintf(stderr, "%s:%d execlp() of "BINDIR"mlmmj-subscribe failed: ", __FILE__, __LINE__); - perror(NULL); + log_error("execlp() of "BINDIR"mlmmj-subscribe" + " failed"); exit(EXIT_FAILURE); } else { /* Not proper confirm */ @@ -98,9 +98,8 @@ "-L", listdir, "-a", fromemails.emaillist[0], "-C", 0); - fprintf(stderr, "%s:%d execlp() of "BINDIR"mlmmj-unsubscribe " - "failed: ", __FILE__, __LINE__); - perror(NULL); + log_error("execlp() of "BINDIR"mlmmj-unsubscribe" + " failed"); exit(EXIT_FAILURE); } else /* Not a valid From: address, so we silently ignore */ exit(EXIT_SUCCESS); @@ -116,14 +115,13 @@ if(strncasecmp(tmpstr, fromemails.emaillist[0], strlen(tmpstr)) == 0) { unlink(conffilename); - execlp(BINDIR"mlmmj-unsubscribe", "mlmmj-unsubscribe", + execlp(BINDIR"mlmmj-unsubscribe", + "mlmmj-unsubscribe", "-L", listdir, "-a", tmpstr, "-c", 0); - fprintf(stderr, "%s:%d execlp() of " - BINDIR"mlmmj-unsubscribe failed: ", - __FILE__, __LINE__); - perror(NULL); + log_error("execlp() of " + BINDIR"mlmmj-unsubscribe failed"); exit(EXIT_FAILURE); } else { exit(EXIT_SUCCESS); diff -r b045203f558b -r f54f95a4c53e src/mlmmj-process.c --- a/src/mlmmj-process.c Thu Apr 22 23:00:27 2004 +1000 +++ b/src/mlmmj-process.c Thu Apr 22 23:15:53 2004 +1000 @@ -24,6 +24,8 @@ #include "strgen.h" #include "do_all_the_voodo_here.h" +#include "log_error.c" + static void print_help(const char *prg) { printf("Usage: %s [-P] -L /path/to/chat-list\n" @@ -84,15 +86,13 @@ if(fd == -1) { free(donemailname); - fprintf(stderr, "%s:%d could not get fd in %s: ", - __FILE__, __LINE__, donemailname); + log_error("could not create mail file in queue directory"); exit(EXIT_FAILURE); } if((donemailfile = fdopen(fd, "w")) == NULL) { free(donemailname); - fprintf(stderr, "%s:%d could not fdopen", - __FILE__, __LINE__); + log_error("could not fdopen() output mail file"); exit(EXIT_FAILURE); } @@ -100,8 +100,7 @@ if((rawmailfile = fopen(mailfile, "r")) == NULL) { free(donemailname); - fprintf(stderr, "%s:%d could not open %s: ", - __FILE__, __LINE__, mailfile); + log_error("could not fopen() input mail file"); exit(EXIT_FAILURE); } @@ -157,8 +156,7 @@ execlp(BINDIR"mlmmj-send", "mlmmj-send", "-L", listdir, "-m", donemailname, 0); - fprintf(stderr, "%s:%d execlp() of mlmmj-send failed: ", - __FILE__, __LINE__); - perror(NULL); + log_error("execlp() of mlmmj-send failed"); + return EXIT_FAILURE; } diff -r b045203f558b -r f54f95a4c53e src/mlmmj-recieve.c --- a/src/mlmmj-recieve.c Thu Apr 22 23:00:27 2004 +1000 +++ b/src/mlmmj-recieve.c Thu Apr 22 23:15:53 2004 +1000 @@ -20,6 +20,8 @@ #include "mygetline.h" #include "strgen.h" +#include "log_error.c" + extern char *optarg; static void print_help(const char *prg) @@ -68,8 +70,7 @@ } if(fd < 0) { - fprintf(stderr, "%s:%d could not get fd in %s: ", - __FILE__, __LINE__, infilename); + log_error("could not create mail file in incoming directory"); free(infilename); exit(EXIT_FAILURE); } @@ -89,13 +90,10 @@ exit(EXIT_SUCCESS); } - execlp("mlmmj-process", "mlmmj-process", + execlp(BINDIR"mlmmj-process", "mlmmj-process", "-L", listdir, "-m", infilename, 0); - - fprintf(stderr, "%s:%d execlp() of mlmmj-process failed: ", - __FILE__, __LINE__); - perror(NULL); + log_error("execlp() of "BINDIR"mlmmj-process failed"); return EXIT_FAILURE; } diff -r b045203f558b -r f54f95a4c53e src/mlmmj-subscribe.c --- a/src/mlmmj-subscribe.c Thu Apr 22 23:00:27 2004 +1000 +++ b/src/mlmmj-subscribe.c Thu Apr 22 23:15:53 2004 +1000 @@ -111,8 +111,7 @@ "-T", subaddr, "-F", fromaddr, "-m", queuefilename, 0); - fprintf(stderr, "%s:%d execlp() of "BINDIR"mlmmj-send failed: ", __FILE__, __LINE__); - perror(NULL); + log_error("execlp() of "BINDIR"mlmmj-send"); exit(EXIT_FAILURE); } @@ -228,8 +227,7 @@ "-F", fromaddr, "-R", confirmaddr, "-m", queuefilename, 0); - fprintf(stderr, "%s:%d execlp() of "BINDIR"mlmmj-send failed: ", __FILE__, __LINE__); - perror(NULL); + log_error("execlp() of "BINDIR"mlmmj-send failed"); exit(EXIT_FAILURE); } diff -r b045203f558b -r f54f95a4c53e src/mlmmj-unsubscribe.c --- a/src/mlmmj-unsubscribe.c Thu Apr 22 23:00:27 2004 +1000 +++ b/src/mlmmj-unsubscribe.c Thu Apr 22 23:15:53 2004 +1000 @@ -112,8 +112,7 @@ "-T", subaddr, "-F", fromaddr, "-m", queuefilename, 0); - fprintf(stderr, "%s:%d execlp() of "BINDIR"mlmmj-send failed: ", __FILE__, __LINE__); - perror(NULL); + log_error("execlp() of "BINDIR"mlmmj-send failed"); exit(EXIT_FAILURE); } @@ -229,8 +228,7 @@ "-F", fromaddr, "-R", confirmaddr, "-m", queuefilename, 0); - fprintf(stderr, "%s:%d execlp() of "BINDIR"mlmmj-send failed: ", __FILE__, __LINE__); - perror(NULL); + log_error("execlp() of "BINDIR"mlmmj-send failed"); exit(EXIT_FAILURE); } diff -r b045203f558b -r f54f95a4c53e src/send_help.c --- a/src/send_help.c Thu Apr 22 23:00:27 2004 +1000 +++ b/src/send_help.c Thu Apr 22 23:15:53 2004 +1000 @@ -115,7 +115,6 @@ "-T", emailaddr, "-F", fromaddr, "-m", queuefilename, 0); - fprintf(stderr, "%s:%d execlp() of "BINDIR"mlmmj-send failed: ", __FILE__, __LINE__); - perror(NULL); + log_error("execlp() of "BINDIR"mlmmj-send failed"); exit(EXIT_FAILURE); } diff -r b045203f558b -r f54f95a4c53e src/strip_file_to_fd.c --- a/src/strip_file_to_fd.c Thu Apr 22 23:00:27 2004 +1000 +++ b/src/strip_file_to_fd.c Thu Apr 22 23:15:53 2004 +1000 @@ -15,6 +15,7 @@ #include "mlmmj.h" #include "wrappers.h" +#include "log_error.c" char *strip_headers(char *buf, const char **headers) { @@ -84,7 +85,7 @@ if(buf[0]) { bytes_written = writen(out_fd, buf, strlen(buf)); if(bytes_written == -1) { - perror(":error writing to fd"); + log_error("error writing to fd"); exit(EXIT_FAILURE); } }