]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
Now it at least compiles
authormmj <none@none>
Thu, 13 Jan 2005 18:40:31 +0000 (05:40 +1100)
committermmj <none@none>
Thu, 13 Jan 2005 18:40:31 +0000 (05:40 +1100)
include/log_oper.h
include/mlmmj.h
listtexts/Makefile.am
src/Makefile.am
src/log_oper.c
src/mlmmj-maintd.c
src/mlmmj-recieve.c
src/mylocking.c

index e99289a25dc84c89e78fcd22e9c6676793ae0a48..06778de9aa8e70e33011581589cef5a5b622ae9a 100644 (file)
@@ -24,6 +24,6 @@
 #ifndef LOG_OPER_H
 #define LOG_OPER_H
 
-void log_oper(const char *logfilename, const char *str);
+int log_oper(const char *logfilename, const char *str);
 
 #endif /* LOG_OPER_H */
index 595c74cb5e76cff752d4d0ba005de3c9a203c7b4..79050100383d3b0f20129200f67355f08ab6603a 100644 (file)
@@ -53,6 +53,7 @@
                           * digest */
 #define DIGESTMIMETYPE "digest" /* Which sub-type of multipart to use when
                                 * sending digest mails */
+#define OPLOGFNAME "mlmmj.operation.log" /* logfile to log operations */
 
 struct strlist {
        int count;
index 8054e5f20ead36485d274e05540b43114c19b9b3..41e07e48e09bde55bb91d2d66662f5419bdd58ea 100644 (file)
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 
-
+textlibdir = $(pkgdatadir)/text.skel
 dist_textlib_DATA = access bounce-probe listhelp moderation notifysub \
        notifysub-digest notifysub-nomail notifyunsub notifyunsub-digest \
        notifyunsub-nomail notintocc sub-confirm sub-confirm-digest \
index f4127af5db9fcd94a74a7e6a0f2d7cd90802edc8..08e13ff95c8a0977024ec4df129ce078ccccc1cd 100644 (file)
@@ -19,7 +19,8 @@ mlmmj_send_SOURCES = mlmmj-send.c writen.c mail-functions.c itoa.c chomp.c \
                     statctrl.c ctrlvalue.c
 
 mlmmj_recieve_SOURCES = mlmmj-recieve.c writen.c random-int.c strgen.c \
-                       print-version.c log_error.c dumpfd2fd.c memory.c
+                       print-version.c log_error.c dumpfd2fd.c memory.c \
+                       log_oper.c mylocking.c
 
 mlmmj_process_SOURCES = mlmmj-process.c writen.c find_email_adr.c \
                        incindexfile.c itoa.c getlistaddr.c chomp.c \
index 545f8dfdd376be8b3eaf64ca4c192a06cb7911a4..a2a54ac6a2b3db405e282c96873ca73250aeadba 100644 (file)
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <string.h>
 
 #include "mlmmj.h"
 #include "log_error.h"
 #include "log_oper.h"
+#include "strgen.h"
+#include "mylocking.h"
+#include "wrappers.h"
+#include "memory.h"
 
 int log_oper(const char *logfilename, const char *str)
 {
+       int fd;
        char ct[26], *logstr;
        struct stat st;
        time_t t;
index 07f2fe5a9949e30bd8c78c76fb8a93af44aeb9c0..f40b56f46349b8a727ecbbced8bfe5f6390302b8 100644 (file)
@@ -192,11 +192,12 @@ int discardmail(const char *old, const char *new, time_t age)
        stat(old, &st);
        t = time(NULL);
 
-       if(t - st.st_mtime > age)
+       if(t - st.st_mtime > age) {
                if(rename(old, new) < 0)
                        ret = 0;
                else
                        ret = 1;
+       }
 
        myunlock(fd);
        close(fd);
index f1fdbbbf7916775639770a452a6e441a51a7347a..dd5defcb7d070a2167fbf85db93184efabec582e 100644 (file)
@@ -37,6 +37,7 @@
 #include "strgen.h"
 #include "log_error.h"
 #include "memory.h"
+#include "log_oper.h"
 
 extern char *optarg;
 
@@ -55,7 +56,7 @@ int main(int argc, char **argv)
 {
        char *infilename = NULL, *listdir = NULL;
        char *randomstr = random_str();
-       char *mlmmjprocess, *bindir;
+       char *mlmmjprocess, *bindir, *logstr;
        int fd, opt, noprocess = 0, nofork = 0;
        struct stat st;
        uid_t uid;
@@ -140,9 +141,9 @@ int main(int argc, char **argv)
 
        fsync(fd);
 
-#if 0
-       log_error(LOG_ARGS, "mlmmj-recieve: wrote %s\n", infilename);
-#endif
+       logstr = concatstr(2, "mlmmj-recieve: wrote ", infilename);
+       log_oper(OPLOGFNAME, logstr);
+       myfree(logstr);
        close(fd);
 
        if(noprocess) {
index 2d25f9c9c32744ae8d5ab2d4fd748211c7ac0a84..9237d1f0c982cdbcba5582485bc5f2527c105b17 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Mads Martin Joergensen <mmj at mmj.dk>
+/* Copyright (C) 2002, 2003, 2005 Mads Martin Joergensen <mmj at mmj.dk>
  *
  * $Id$
  *
@@ -23,6 +23,8 @@
 
 #include <unistd.h>
 #include <fcntl.h>
+#include <errno.h>
+
 #include "mylocking.h"
 
 int myexcllock(int fd)
@@ -36,7 +38,7 @@ int myexcllock(int fd)
        locktype.l_len = 0;
        do {
                mylock = fcntl(fd, F_SETLKW, &locktype);
-       while(mylock < 0 && errno == EINTR);
+       while(mylock < 0 && errno == EINTR);
 
        return mylock;
 }
@@ -49,7 +51,7 @@ int myunlock(int fd)
        locktype.l_type = F_UNLCK;
        do {
                myunlock = fcntl(fd, F_SETLKW, &locktype);
-       while(myunlock < 0 && errno == EINTR)
+       } while(myunlock < 0 && errno == EINTR);
 
        return myunlock;
 }