Mercurial > hg > mlmmj
changeset 249:01de740a19f9
Also remove .lastmsg files in mlmmj-maintd
author | mmj |
---|---|
date | Sun, 20 Jun 2004 22:52:28 +1000 |
parents | 42186df3f70a |
children | 0af98d48bdd0 |
files | src/mlmmj-bounce.c src/mlmmj-maintd.c src/openrandexclrw.c |
diffstat | 3 files changed, 29 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/mlmmj-bounce.c Sat Jun 19 14:10:30 2004 +1000 +++ b/src/mlmmj-bounce.c Sun Jun 20 22:52:28 2004 +1000 @@ -327,8 +327,11 @@ writen(fd, buf, strlen(buf)); close(fd); - if(mailname) - unlink(mailname); + if(mailname) { + savename = concatstr(2, bfilename, ".lastmsg"); + rename(mailname, savename); + free(savename); + } myfree(bfilename);
--- a/src/mlmmj-maintd.c Sat Jun 19 14:10:30 2004 +1000 +++ b/src/mlmmj-maintd.c Sun Jun 20 22:52:28 2004 +1000 @@ -447,6 +447,9 @@ unlink(filename); *s = '\0'; unlink(filename); + s = concatstr(2, filename, ".lastmsg"); + unlink(s); + myfree(s); } } myfree(filename); @@ -461,7 +464,7 @@ { DIR *bouncedir; char *dirname = concatstr(2, listdir, "/bounce/"); - char *probefile; + char *probefile, *s; struct dirent *dp; struct stat st; pid_t pid, childpid; @@ -494,6 +497,10 @@ if(strstr(dp->d_name, "-probe")) continue; + s = strrchr(dp->d_name, "."); + if(s && (strcmp(s, ".lastmsg") == 0)) + continue; + probefile = concatstr(2, dp->d_name, "-probe"); /* Skip files which already have a probe out */ @@ -569,6 +576,14 @@ if(strstr(dp->d_name, "-probe")) continue; + a = strrchr(dp->d_name, "."); + if(a && (strcmp(a, ".lastmsg") == 0)) { + free(a); + continue; + } + + free(a); + probefile = concatstr(2, dp->d_name, "-probe"); /* Skip files which already have a probe out */ @@ -638,6 +653,9 @@ pid = waitpid(childpid, &status, 0); while(pid == -1 && errno == EINTR); unlink(dp->d_name); + a = concatstr(2, dp->d_name, ".lastmsg"); + unlink(a); + free(a); } else { execlp(mlmmjunsub, mlmmjunsub, "-L", listdir,
--- a/src/openrandexclrw.c Sat Jun 19 14:10:30 2004 +1000 +++ b/src/openrandexclrw.c Sun Jun 20 22:52:28 2004 +1000 @@ -32,7 +32,8 @@ #include "wrappers.h" #include "memory.h" -int openrandexclrw(const char *dir, const char *prefix, mode_t mode) +int openrandexclrw(const char *dir, const char *prefix, mode_t mode, + char *name) { int fd; char *filename = NULL, *randomstr; @@ -48,7 +49,7 @@ } while ((fd < 0) && (errno == EEXIST)); - /* TODO error checking, bail out */ + name = filename; return fd; }