Mercurial > hg > mlmmj
changeset 820:ae97908485e9
Only stat files after discounting ignored filenames.
This eliminates confusing log messages similar to
mlmmj-maintd.c:511: Could not stat(auser=example.com.lastmsg): No such file or directory
These occur when bouncing users are unsubscribed because the .lastmsg files
are checked after the auser=example.com files with no extensions.
author | Richard Mortimer |
---|---|
date | Tue, 25 Jan 2011 16:35:25 +0000 |
parents | 6cc2a4cdc468 |
children | bf600175dc16 |
files | src/mlmmj-maintd.c |
diffstat | 1 files changed, 17 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/mlmmj-maintd.c Tue Jan 25 15:21:40 2011 +0000 +++ b/src/mlmmj-maintd.c Tue Jan 25 16:35:25 2011 +0000 @@ -521,14 +521,16 @@ (strcmp(dp->d_name, ".") == 0)) continue; - if(stat(dp->d_name, &st) < 0) { - log_error(LOG_ARGS, "Could not stat(%s)", dp->d_name); + filename = mystrdup(dp->d_name); + + if((s = strstr(filename, "-probe"))) { + if(stat(filename, &st) < 0) { + log_error(LOG_ARGS, "Could not stat(%s)", + filename); + myfree(filename); continue; } - filename = mystrdup(dp->d_name); - - if((s = strstr(filename, "-probe"))) { probefd = open(filename, O_RDONLY); if(probefd < 0) continue; @@ -586,11 +588,6 @@ (strcmp(dp->d_name, ".") == 0)) continue; - if(stat(dp->d_name, &st) < 0) { - log_error(LOG_ARGS, "Could not stat(%s)", dp->d_name); - continue; - } - if(strstr(dp->d_name, "-probe")) continue; @@ -598,6 +595,11 @@ if(s && (strcmp(s, ".lastmsg") == 0)) continue; + if(stat(dp->d_name, &st) < 0) { + log_error(LOG_ARGS, "Could not stat(%s)", dp->d_name); + continue; + } + probefile = concatstr(2, dp->d_name, "-probe"); /* Skip files which already have a probe out */ @@ -675,11 +677,6 @@ (strcmp(dp->d_name, ".") == 0)) continue; - if(stat(dp->d_name, &st) < 0) { - log_error(LOG_ARGS, "Could not stat(%s)", dp->d_name); - continue; - } - if(strstr(dp->d_name, "-probe")) continue; @@ -687,6 +684,11 @@ if(a && (strcmp(a, ".lastmsg") == 0)) continue; + if(stat(dp->d_name, &st) < 0) { + log_error(LOG_ARGS, "Could not stat(%s)", dp->d_name); + continue; + } + probefile = concatstr(2, dp->d_name, "-probe"); /* Skip files which already have a probe out */