]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
changed log_error() to be a function (no C99 here)
authormortenp <none@none>
Fri, 23 Apr 2004 16:51:33 +0000 (02:51 +1000)
committermortenp <none@none>
Fri, 23 Apr 2004 16:51:33 +0000 (02:51 +1000)
13 files changed:
include/log_error.h
src/getlistaddr.c
src/incindexfile.c
src/init_sockfd.c
src/listcontrol.c
src/log_error.c
src/mail-functions.c
src/mlmmj-process.c
src/mlmmj-recieve.c
src/mlmmj-send.c
src/mlmmj-sub.c
src/mlmmj-unsub.c
src/send_help.c

index 9f9036e54da601beb3ee2e9478abd8491b9f1880..9a01b42f3952e49ad5930d8cca18cc0de7cf4e40 100644 (file)
@@ -9,9 +9,12 @@
 #ifndef LOG_ERROR_H
 #define LOG_ERROR_H
 
-#define log_error(msg) log_error_do(msg,__FILE__,__LINE__)
+#include <errno.h>
+
+#define LOG_ARGS __FILE__, __LINE__, strerror(errno)
 
 void log_set_name(const char *name);
-void log_error_do(const char *msg, const char *file, int line);
+void log_error(const char *file, int line, const char *errstr,
+               const char *fmt, ...);
 
 #endif /* LOG_ERROR_H */
index 1bf0d9c2ff115be88f108d0c864aca5411abd020..8b466f8825e89addf1a0f08e9d23b775831e2dab 100644 (file)
@@ -27,7 +27,7 @@ char *getlistaddr(char *listaddrdeststr, const char *listdir)
 
        snprintf(tmpstr, len, "%s/listaddress", listdir);
        if((listnamefile = fopen(tmpstr, "r")) == NULL) {
-               log_error("Could not get listname:");
+               log_error(LOG_ARGS, "Could not open '%s'", tmpstr);
                exit(EXIT_FAILURE);
        }
 
index 03103654b90372b0e0948bbcd0964292563ee135..5dd5751e8a3af56409dc5d8349ad7bf477732f49 100644 (file)
@@ -40,14 +40,14 @@ int incindexfile(const char *listdir, int incflag)
        fd = open(indexfilename, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);
 
        if(fd == -1) {
-               log_error("Error opening index file");
+               log_error(LOG_ARGS, "Error opening index file");
                exit(EXIT_FAILURE);
        }
 
        lock = myexcllock(fd);
        
        if(lock) {
-               log_error("Error locking index file");
+               log_error(LOG_ARGS, "Error locking index file");
                close(fd);
                exit(EXIT_FAILURE);
        }
index c780ded10720053fc8516090e9b1a774102c86aa..874442a396a866feeab426dbad9e3fb73e8464f1 100644 (file)
@@ -21,7 +21,7 @@ void init_sockfd(int *sockfd, const char *relayhost)
 
        *sockfd = socket(PF_INET, SOCK_STREAM, 0);
        if(*sockfd == -1) {
-               log_error( "Could not get socket");
+               log_error(LOG_ARGS, "Could not get socket");
                exit(EXIT_FAILURE);
        }
        addr.sin_family = PF_INET;
@@ -29,7 +29,7 @@ void init_sockfd(int *sockfd, const char *relayhost)
        addr.sin_port = htons(25);
        len = sizeof(addr);
        if(connect(*sockfd, (struct sockaddr *)&addr, len) == -1) {
-               log_error("Could not connect");
+               log_error(LOG_ARGS, "Could not connect");
                exit(EXIT_FAILURE);
        }
 }
index 36dd957a67ac204e7af7eac00d99981749dc997e..611d7088302995088be49a8eb7c0967fe3d01b65 100644 (file)
@@ -32,7 +32,7 @@ int listcontrol(const char *mailfilename, const char *listdir,
        size_t len;
        
        if((mailfile = fopen(mailfilename, "r")) == NULL) {
-               log_error("listcontrol, could not open mail");
+               log_error(LOG_ARGS, "listcontrol, could not open mail");
                exit(EXIT_FAILURE);
        }
        recipdelimsign = index(controladdr, RECIPDELIM);
@@ -57,7 +57,7 @@ int listcontrol(const char *mailfilename, const char *listdir,
                                        "-L", listdir,
                                        "-a", fromemails.emaillist[0],
                                        "-C", 0);
-                       log_error("execlp() of mlmmj-sub failed");
+                       log_error(LOG_ARGS, "execlp() of '%s' failed", mlmmjsub);
                        exit(EXIT_FAILURE);
                } else /* Not a valid From: address, so we silently ignore */
                        exit(EXIT_SUCCESS);
@@ -77,7 +77,7 @@ int listcontrol(const char *mailfilename, const char *listdir,
                                                "-L", listdir,
                                                "-a", tmpstr,
                                                "-c", 0);
-                               log_error("execlp() of mlmmj-sub failed");
+                               log_error(LOG_ARGS, "execlp() of '%s' failed", mlmmjsub);
                                exit(EXIT_FAILURE);
                        } else {
                                /* Not proper confirm */
@@ -92,7 +92,7 @@ int listcontrol(const char *mailfilename, const char *listdir,
                                        "-L", listdir,
                                        "-a", fromemails.emaillist[0],
                                        "-C", 0);
-                       log_error("execlp() of mlmmj-unsub failed");
+                       log_error(LOG_ARGS, "execlp() of '%s' failed", mlmmjunsub);
                        exit(EXIT_FAILURE);
                } else /* Not a valid From: address, so we silently ignore */
                        exit(EXIT_SUCCESS);
@@ -112,7 +112,7 @@ int listcontrol(const char *mailfilename, const char *listdir,
                                                "-L", listdir,
                                                "-a", tmpstr,
                                                "-c", 0);
-                               log_error("execlp() of mlmmj-unsub failed");
+                               log_error(LOG_ARGS, "execlp() of '%s' failed", mlmmjunsub);
                                exit(EXIT_FAILURE);
                        } else {
                                exit(EXIT_SUCCESS);
index 7535627604302450589460aadec6ba22989df992..4db900596bb010530a77e30d636f48e048dd8844 100644 (file)
@@ -1,9 +1,7 @@
-#include <sys/types.h>
-#include <unistd.h>
 #include <stdio.h>
 #include <string.h>
-#include <errno.h>
 #include <stdlib.h>
+#include <stdarg.h>
 
 #include "log_error.h"
 #include "../config.h"
@@ -20,19 +18,27 @@ void log_set_name(const char* name)
        log_name = strdup(name);
 }
 
-void log_error_do(const char *msg, const char *file, int line)
+void log_error(const char *file, int line, const char *errstr,
+       const char *fmt, ...)
 {
        static int syslog_is_open = 0;
+       char buf[1024];
+       va_list ap;
+
+       va_start(ap, fmt);
+       vsnprintf(buf, sizeof(buf), fmt, ap);
+       va_end(ap);
+
        if (!log_name) log_name = "mlmmj-UNKNOWN";
+
 #ifdef HAVE_SYSLOG
        if(!syslog_is_open) {
                openlog(log_name, LOG_PID|LOG_CONS, LOG_MAIL);
                syslog_is_open = 1;
        }
-       syslog(LOG_ERR, "%s:%d: %s: %s", file, line, msg, strerror(errno));
+       syslog(LOG_ERR, "%s:%d: %s: %s", file, line, buf, errstr);
 #else
        fprintf(stderr, "%s[%d]: %s:%d: %s: %s\n", log_name, (int)getpid(),
-                       file, line,
-                       msg, strerror(errno));
+                       file, line, buf, errstr);
 #endif
 }
index 7897cfd3a3c1ffad0f3e3dec38331d67ebce20b6..7cedac5e487310856d4a28fb5e0a0210161ae289 100644 (file)
@@ -39,7 +39,7 @@ int write_helo(int sockfd, const char *hostname)
 #endif
        bytes_written = writen(sockfd, helo, len);
        if(bytes_written < 0) {
-               log_error("Could not write HELO");
+               log_error(LOG_ARGS, "Could not write HELO");
                free(helo);
                return errno;
        }
@@ -64,7 +64,7 @@ int write_mail_from(int sockfd, const char *from_addr)
 #endif
        bytes_written = writen(sockfd, mail_from, len);
        if(bytes_written < 0) {
-               log_error("Could not write FROM");
+               log_error(LOG_ARGS, "Could not write FROM");
                free(mail_from);
                return errno;
        }
@@ -92,7 +92,7 @@ int write_rcpt_to(int sockfd, const char *rcpt_addr)
 #endif
        bytes_written = writen(sockfd, rcpt_to, len);
        if(bytes_written < 0) {
-               log_error( "Could not write TO" );
+               log_error(LOG_ARGS, "Could not write TO");
                free(rcpt_to);
                return errno;
        }
@@ -113,7 +113,7 @@ int write_mailbody_from_file(int sockfd, FILE *infile)
        /* Read from beginning of the file */
 
        if(fseek(infile, 0L, SEEK_SET) == -1) {
-               log_error("write_crlf,fseek");
+               log_error(LOG_ARGS, "fseek() failed");
                return errno;
        }
        
@@ -168,7 +168,7 @@ int write_custom_line(int sockfd, const char *line)
 #endif
        bytes_written = writen(sockfd, customline, len);
        if(bytes_written < 0) {
-               log_error( "Could not write customline" );
+               log_error(LOG_ARGS, "Could not write customline");
                free(customline);
                return errno;
        }
@@ -196,7 +196,7 @@ int write_replyto(int sockfd, const char *replyaddr)
 #endif
        bytes_written = writen(sockfd, replyto, len);
        if(bytes_written < 0) {
-               log_error( "Could not write Reply-To:" );
+               log_error(LOG_ARGS, "Could not write Reply-To header");
                free(replyto);
                return errno;
        }
@@ -207,7 +207,7 @@ int write_replyto(int sockfd, const char *replyaddr)
 int write_data(int sockfd)
 {
        if(write_custom_line(sockfd, "DATA")) {
-               log_error("mail-functions.c:write_data");
+               log_error(LOG_ARGS, "Could not write DATA");
                return errno;
        }
 
@@ -217,7 +217,7 @@ int write_data(int sockfd)
 int write_quit(int sockfd)
 {
        if(write_custom_line(sockfd, "QUIT")) {
-               log_error("mail-functions.c:write_quit");
+               log_error(LOG_ARGS, "Could not write QUIT");
                return errno;
        }
 
@@ -227,7 +227,7 @@ int write_quit(int sockfd)
 int write_rset(int sockfd)
 {
        if(write_custom_line(sockfd, "RSET")) {
-               log_error("mail-functions.c:write_rset");
+               log_error(LOG_ARGS, "Could not write RSET");
                return errno;
        }
 
index 471daf10ede446a4f839c6b39624126d348edbf7..6630dcfb6290e33db5d017444aaec89b38837cd6 100644 (file)
@@ -97,13 +97,13 @@ int main(int argc, char **argv)
        
        if(fd == -1) {
                free(donemailname);
-               log_error("could not create mail file in queue directory");
+               log_error(LOG_ARGS, "could not create mail file in queue directory");
                exit(EXIT_FAILURE);
        }
 
        if((donemailfile = fdopen(fd, "w")) == NULL) {
                free(donemailname);
-               log_error("could not fdopen() output mail file");
+               log_error(LOG_ARGS, "could not fdopen() output mail file");
                exit(EXIT_FAILURE);
        }
 
@@ -111,7 +111,7 @@ int main(int argc, char **argv)
 
        if((rawmailfile = fopen(mailfile, "r")) == NULL) {
                free(donemailname);
-               log_error("could not fopen() input mail file");
+               log_error(LOG_ARGS, "could not fopen() input mail file");
                exit(EXIT_FAILURE);
        }
 
@@ -169,7 +169,7 @@ int main(int argc, char **argv)
        execlp(mlmmjsend, mlmmjsend,
                                "-L", listdir,
                                "-m", donemailname, 0);
-       log_error("execlp() of mlmmj-send failed");
+       log_error(LOG_ARGS, "execlp() of '%s' failed", mlmmjsend);
 
        return EXIT_FAILURE;
 }
index 84f0974731e9681891b6afe9c5aae57a5eaefa9c..bfe4040c9136e22e8aa99ba59425caaadc128fbd 100644 (file)
@@ -74,7 +74,7 @@ int main(int argc, char **argv)
        }
 
        if(fd < 0) {
-               log_error("could not create mail file in incoming directory");
+               log_error(LOG_ARGS, "could not create mail file in incoming directory");
                free(infilename);
                exit(EXIT_FAILURE);
        }
@@ -97,7 +97,7 @@ int main(int argc, char **argv)
        execlp(mlmmjprocess, mlmmjprocess,
                                "-L", listdir,
                                "-m", infilename, 0);
-       log_error("execlp() of mlmmj-process failed");
+       log_error(LOG_ARGS, "execlp() of '%s' failed", mlmmjprocess);
 
        return EXIT_FAILURE;
 }
index 5c78659a56c81a944b401f5e67cd22ad4fa405ab..3f1323c25e1e8718bc9f1772dc5a76eeff63f5b2 100644 (file)
@@ -85,65 +85,65 @@ int send_mail(int sockfd, const char *from, const char *to, const char *replyto,
        int retval;
 
        if((retval = write_mail_from(sockfd, from)) != 0) {
-               log_error("Could not write MAIL FROM\n");
+               log_error(LOG_ARGS, "Could not write MAIL FROM\n");
                /* FIXME: Queue etc.*/
                write_rset(sockfd);
                return retval;
        }
        if((retval = checkwait_smtpreply(sockfd, MLMMJ_FROM)) != 0) {
-               log_error("Wrong MAIL FROM:\n");
+               log_error(LOG_ARGS, "Wrong MAIL FROM:\n");
                write_rset(sockfd);
                /* FIXME: Queue etc.*/
                return retval;
        }
 
        if((retval = write_rcpt_to(sockfd, to)) != 0) {
-               log_error("Could not write RCPT TO:\n");
+               log_error(LOG_ARGS, "Could not write RCPT TO:\n");
                /* FIXME: Queue etc.*/
                write_rset(sockfd);
                return retval;
        }
        if((retval = checkwait_smtpreply(sockfd, MLMMJ_RCPTTO)) != 0) {
-               log_error("Wrong RCPT TO:\n");
+               log_error(LOG_ARGS, "Wrong RCPT TO:\n");
                write_rset(sockfd);
                /* FIXME: Queue etc.*/
                return retval;
        }
        if((retval = write_data(sockfd)) != 0) {
-               log_error("Could not write DATA\b");
+               log_error(LOG_ARGS, "Could not write DATA\b");
                write_rset(sockfd);
                /* FIXME: Queue etc.*/
                return retval;
        }
        if((checkwait_smtpreply(sockfd, MLMMJ_DATA)) != 0) {
-               log_error("Mailserver not ready for DATA\n");
+               log_error(LOG_ARGS, "Mailserver not ready for DATA\n");
                write_rset(sockfd);
                /* FIXME: Queue etc.*/
                return retval;
        }
        if(replyto)
                if((retval = write_replyto(sockfd, replyto)) != 0) {
-                       log_error("Could not write reply-to addr.\n");
+                       log_error(LOG_ARGS, "Could not write reply-to addr.\n");
                        write_rset(sockfd);
                        /* FIXME: Queue etc.*/
                        return retval;
                }
        if((retval = write_mailbody_from_file(sockfd, mailfile)) != 0) {
-               log_error("Could not write mailbody\n");
+               log_error(LOG_ARGS, "Could not write mailbody\n");
                write_rset(sockfd);
                /* FIXME: Queue etc.*/
                return retval;
        }
 
        if((retval = write_dot(sockfd)) != 0) {
-               log_error("Could not write <CR><LF>.<CR><LF>\n");
+               log_error(LOG_ARGS, "Could not write <CR><LF>.<CR><LF>\n");
                write_rset(sockfd);
                /* FIXME: Queue etc.*/
                return retval;
        }
 
        if((checkwait_smtpreply(sockfd, MLMMJ_DOT)) != 0) {
-               log_error("Mailserver did not acknowledge end of mail\n"
+               log_error(LOG_ARGS, "Mailserver did not acknowledge end of mail\n"
                                "<CR><LF>.<CR><LF> was written, to no"
                                "avail\n");
                write_rset(sockfd);
@@ -221,7 +221,7 @@ int main(int argc, char **argv)
        /* initialize file with mail to send */
 
        if((mailfile = fopen(mailfilename, "r")) == NULL) {
-               log_error(mailfilename);
+               log_error(LOG_ARGS, "Could not open '%s'", mailfilename);
                exit(EXIT_FAILURE);
        }
 
@@ -238,7 +238,7 @@ int main(int argc, char **argv)
        if(listdir[0] != '1') {
                subfilename = concatstr(2, listdir, "/subscribers");
                if((subfile = fopen(subfilename, "r")) == NULL) {
-                       log_error("Could not open subscriberfile:");
+                       log_error(LOG_ARGS, "Could not open subscriberfile:");
                        exit(EXIT_FAILURE);
                }
        }
@@ -252,13 +252,13 @@ int main(int argc, char **argv)
        }
 
        if((retval = checkwait_smtpreply(sockfd, MLMMJ_CONNECT)) != 0) {
-               log_error("No proper greeting to our connect\n"
+               log_error(LOG_ARGS, "No proper greeting to our connect\n"
                          "We continue and hope for the best\n");
                /* FIXME: Queue etc. */
        }       
        write_helo(sockfd, "localhost");
        if((checkwait_smtpreply(sockfd, MLMMJ_HELO)) != 0) {
-               log_error("Error with HELO\n"
+               log_error(LOG_ARGS, "Error with HELO\n"
                          "We continue and hope for the best\n");
                /* FIXME: quit and tell admin to configure correctly */
        }
@@ -277,7 +277,7 @@ int main(int argc, char **argv)
 
        write_quit(sockfd);
        if((checkwait_smtpreply(sockfd, MLMMJ_QUIT)) != 0) {
-               log_error("Mailserver would not let us QUIT\n"
+               log_error(LOG_ARGS, "Mailserver would not let us QUIT\n"
                          "We close the socket anyway though\n");
        }
 
index 2f97c41b94dc3ddce57cd31679e78f679fa43995..f8b4745e09e72b2c39d50a34fd6825625e92f4f2 100644 (file)
@@ -40,7 +40,7 @@ void confirm_sub(const char *listdir, const char *listaddr,
        subtextfilename = concatstr(2, listdir, "/text/sub-ok");
 
        if((subtextfile = fopen(subtextfilename, "r")) == NULL) {
-               log_error("Could not open text/sub-confirm\n");
+               log_error(LOG_ARGS, "Could not open '%s'", subtextfilename);
                free(subtextfilename);
                exit(EXIT_FAILURE);
        }
@@ -55,7 +55,7 @@ void confirm_sub(const char *listdir, const char *listaddr,
        printf("%s\n", queuefilename);
 
        if((queuefile = fopen(queuefilename, "w")) == NULL) {
-               log_error(queuefilename);
+               log_error(LOG_ARGS, "Could not open '%s'", queuefilename);
                free(queuefilename);
                free(randomstr);
                exit(EXIT_FAILURE);
@@ -104,7 +104,7 @@ void confirm_sub(const char *listdir, const char *listaddr,
                                "-T", subaddr,
                                "-F", fromaddr,
                                "-m", queuefilename, 0);
-       log_error("execlp() of mlmmj-send failed");
+       log_error(LOG_ARGS, "execlp() of '%s' failed", mlmmjsend);
        exit(EXIT_FAILURE);
 }
 
@@ -124,7 +124,7 @@ void generate_subconfirm(const char *listdir, const char *listaddr,
        confirmfilename = concatstr(3, listdir, "/subconf/", randomstr);
 
        if((subconffile = fopen(confirmfilename, "w")) == NULL) {
-               log_error(confirmfilename);
+               log_error(LOG_ARGS, "Could not open '%s'", confirmfilename);
                free(confirmfilename);
                free(randomstr);
                exit(EXIT_FAILURE);
@@ -151,7 +151,7 @@ void generate_subconfirm(const char *listdir, const char *listaddr,
        subtextfilename = concatstr(2, listdir, "/text/sub-confirm");
 
        if((subtextfile = fopen(subtextfilename, "r")) == NULL) {
-               log_error("Could not open text/sub-confirm\n");
+               log_error(LOG_ARGS, "Could not open '%s'", subtextfilename);
                free(randomstr);
                free(subtextfilename);
                exit(EXIT_FAILURE);
@@ -163,7 +163,7 @@ void generate_subconfirm(const char *listdir, const char *listaddr,
        printf("%s\n", queuefilename);
 
        if((queuefile = fopen(queuefilename, "w")) == NULL) {
-               log_error(queuefilename);
+               log_error(LOG_ARGS, "Could not open '%s'", queuefilename);
                free(queuefilename);
                free(randomstr);
                exit(EXIT_FAILURE);
@@ -208,7 +208,7 @@ void generate_subconfirm(const char *listdir, const char *listaddr,
                                "-F", fromaddr,
                                "-R", confirmaddr,
                                "-m", queuefilename, 0);
-       log_error("execlp() of mlmmj-send failed");
+       log_error(LOG_ARGS, "execlp() of '%s' failed", mlmmjsend);
        exit(EXIT_FAILURE);
 }
 
@@ -282,13 +282,13 @@ int main(int argc, char **argv)
 
        subfilefd = open(subfilename, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR);
        if(subfilefd == -1) {
-               log_error("Could not open subscriberfile:");
+               log_error(LOG_ARGS, "Could not open '%s'", subfilename);
                exit(EXIT_FAILURE);
        }
 
        lock = myexcllock(subfilefd);
        if(lock) {
-               log_error("Error locking subscriber file:");
+               log_error(LOG_ARGS, "Error locking subscriber file");
                close(subfilefd);
                exit(EXIT_FAILURE);
        }
index c963983820f05ef1cf177ebb11d54230f02afaf6..4c5d03cdf6d14be7414932e45c70209cb826b8ae 100644 (file)
@@ -41,7 +41,7 @@ void confirm_unsub(const char *listdir, const char *listaddr,
        subtextfilename = concatstr(2, listdir, "/text/unsub-ok");
 
        if((subtextfile = fopen(subtextfilename, "r")) == NULL) {
-               log_error("Could not open text/unsub-ok\n");
+               log_error(LOG_ARGS, "Could not open '%s'", subtextfilename);
                free(subtextfilename);
                exit(EXIT_FAILURE);
        }
@@ -56,7 +56,7 @@ void confirm_unsub(const char *listdir, const char *listaddr,
        printf("%s\n", queuefilename);
 
        if((queuefile = fopen(queuefilename, "w")) == NULL) {
-               log_error(queuefilename);
+               log_error(LOG_ARGS, "Could not open '%s'", queuefilename);
                free(queuefilename);
                free(randomstr);
                exit(EXIT_FAILURE);
@@ -105,7 +105,7 @@ void confirm_unsub(const char *listdir, const char *listaddr,
                                "-T", subaddr,
                                "-F", fromaddr,
                                "-m", queuefilename, 0);
-       log_error("execlp() of mlmmjsend failed");
+       log_error(LOG_ARGS, "execlp() of '%s' failed", mlmmjsend);
        exit(EXIT_FAILURE);
 }
 
@@ -125,7 +125,7 @@ void generate_unsubconfirm(const char *listdir, const char *listaddr,
        confirmfilename = concatstr(3, listdir, "/unsubconf/", randomstr);
 
        if((subconffile = fopen(confirmfilename, "w")) == NULL) {
-               log_error(confirmfilename);
+               log_error(LOG_ARGS, "Could not open '%s'", confirmfilename);
                free(confirmfilename);
                free(randomstr);
                exit(EXIT_FAILURE);
@@ -152,7 +152,7 @@ void generate_unsubconfirm(const char *listdir, const char *listaddr,
        subtextfilename = concatstr(2, listdir, "/text/unsub-confirm");
 
        if((subtextfile = fopen(subtextfilename, "r")) == NULL) {
-               log_error("Could not open text/unsub-confirm\n");
+               log_error(LOG_ARGS, "Could not open '%s'", subtextfilename);
                free(randomstr);
                free(subtextfilename);
                exit(EXIT_FAILURE);
@@ -164,7 +164,7 @@ void generate_unsubconfirm(const char *listdir, const char *listaddr,
        printf("%s\n", queuefilename);
 
        if((queuefile = fopen(queuefilename, "w")) == NULL) {
-               log_error(queuefilename);
+               log_error(LOG_ARGS, "Could not open '%s'", queuefilename);
                free(queuefilename);
                free(randomstr);
                exit(EXIT_FAILURE);
@@ -209,7 +209,7 @@ void generate_unsubconfirm(const char *listdir, const char *listaddr,
                                "-F", fromaddr,
                                "-R", confirmaddr,
                                "-m", queuefilename, 0);
-       log_error("execlp() of mlmmj-send failed");
+       log_error(LOG_ARGS, "execlp() of '%s' failed", mlmmjsend);
        exit(EXIT_FAILURE);
 }
 
@@ -293,13 +293,13 @@ int main(int argc, char **argv)
 
        subread = open(subreadname, O_RDWR);
        if(subread == -1) {
-               log_error("Could not open subscriberfile:");
+               log_error(LOG_ARGS, "Could not open '%s'", subreadname);
                exit(EXIT_FAILURE);
        }
 
        sublock = myexcllock(subread);
        if(sublock) {
-               log_error("Error locking subscriber file:");
+               log_error(LOG_ARGS, "Error locking subscriber file");
                close(subread);
                exit(EXIT_FAILURE);
        }
@@ -313,7 +313,7 @@ int main(int argc, char **argv)
 
        subwrite = open(subreadname, O_RDWR);
        if(subwrite == -1){
-               log_error("Could not open subfile:");
+               log_error(LOG_ARGS, "Could not open '%s'", subreadname);
                exit(EXIT_FAILURE);
        }
        if(unsubconfirm)
index ff8a662fff7a107347dd2343a743412d1d1ef174..240af2dd06b8ca9b70f9b79c330716f7e4e19c8b 100644 (file)
@@ -34,7 +34,7 @@ void send_help(const char *listdir, const char *emailaddr,
        helpfilename = concatstr(2, listdir, "/text/listhelp");
 
        if((helpfile = fopen(helpfilename, "r")) == NULL) {
-               log_error("Could not open text/help\n");
+               log_error(LOG_ARGS, "Could not open text/help");
                free(helpfilename);
                exit(EXIT_FAILURE);
        }
@@ -49,7 +49,7 @@ void send_help(const char *listdir, const char *emailaddr,
        printf("%s\n", queuefilename);
        
        if((queuefile = fopen(queuefilename, "w")) == NULL) {
-               log_error(queuefilename);
+               log_error(LOG_ARGS, "Could not open '%s'", queuefilename);
                free(queuefilename);
                free(randomstr);
                exit(EXIT_FAILURE);
@@ -106,6 +106,6 @@ void send_help(const char *listdir, const char *emailaddr,
                                "-T", emailaddr,
                                "-F", fromaddr,
                                "-m", queuefilename, 0);
-       log_error("execlp() of mlmmjsend failed");
+       log_error(LOG_ARGS, "execlp() of '%s' failed", mlmmjsend);
        exit(EXIT_FAILURE);
 }