Mercurial > hg > mlmmj
changeset 407:4bfcc62d6a30
Now it at least compiles
author | mmj |
---|---|
date | Fri, 14 Jan 2005 05:40:31 +1100 |
parents | 2f83211fde3f |
children | 9460abf5d0e5 |
files | 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 |
diffstat | 8 files changed, 23 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/include/log_oper.h Fri Jan 14 03:35:40 2005 +1100 +++ b/include/log_oper.h Fri Jan 14 05:40:31 2005 +1100 @@ -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 */
--- a/include/mlmmj.h Fri Jan 14 03:35:40 2005 +1100 +++ b/include/mlmmj.h Fri Jan 14 05:40:31 2005 +1100 @@ -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;
--- a/listtexts/Makefile.am Fri Jan 14 03:35:40 2005 +1100 +++ b/listtexts/Makefile.am Fri Jan 14 05:40:31 2005 +1100 @@ -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 \
--- a/src/Makefile.am Fri Jan 14 03:35:40 2005 +1100 +++ b/src/Makefile.am Fri Jan 14 05:40:31 2005 +1100 @@ -19,7 +19,8 @@ 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 \
--- a/src/log_oper.c Fri Jan 14 03:35:40 2005 +1100 +++ b/src/log_oper.c Fri Jan 14 05:40:31 2005 +1100 @@ -28,13 +28,19 @@ #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;
--- a/src/mlmmj-maintd.c Fri Jan 14 03:35:40 2005 +1100 +++ b/src/mlmmj-maintd.c Fri Jan 14 05:40:31 2005 +1100 @@ -192,11 +192,12 @@ 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);
--- a/src/mlmmj-recieve.c Fri Jan 14 03:35:40 2005 +1100 +++ b/src/mlmmj-recieve.c Fri Jan 14 05:40:31 2005 +1100 @@ -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 @@ { 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 @@ 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) {
--- a/src/mylocking.c Fri Jan 14 03:35:40 2005 +1100 +++ b/src/mylocking.c Fri Jan 14 05:40:31 2005 +1100 @@ -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 @@ 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 @@ locktype.l_type = F_UNLCK; do { myunlock = fcntl(fd, F_SETLKW, &locktype); - while(myunlock < 0 && errno == EINTR) + } while(myunlock < 0 && errno == EINTR); return myunlock; }