Don't report about a new mail when there hasn't been one, i.e. if only
authorJoey Schulze <joey@infodrom.org>
Sun, 29 Jul 2007 18:05:03 +0000 (18:05 +0000)
committerJoey Schulze <joey@infodrom.org>
Sun, 29 Jul 2007 18:05:03 +0000 (18:05 +0000)
a few lines have been read that don't build a proper mail header with
name and subject.  Reported by and patch prepared by Pavel Sanda

mbox.c

diff --git a/mbox.c b/mbox.c
index 4f9d2a6..ecb0c54 100644 (file)
--- a/mbox.c
+++ b/mbox.c
@@ -221,10 +221,13 @@ int inspect_mbox(char *path, char *prefix, off_t size, int opt_flags)
 
        if (strlen(from))
          stringcopy (realfrom, realname(from), sizeof(realfrom));
 
        if (strlen(from))
          stringcopy (realfrom, realname(from), sizeof(realfrom));
-       else
+       else if (strlen(from_))
          stringcopy (realfrom, reduce_from_(from_), sizeof(realfrom));
          stringcopy (realfrom, reduce_from_(from_), sizeof(realfrom));
+       else
+         realfrom[0] = '\0';
 
 
-       emit (prefix, realfrom, subject, priority, opt_flags);
+       if (realfrom[0] != '\0')
+         emit (prefix, realfrom, subject, priority, opt_flags);
 
 #ifdef FROM_DETECTION
        from_[0] = from[0] = to[0] = subject[0] = '\0';
 
 #ifdef FROM_DETECTION
        from_[0] = from[0] = to[0] = subject[0] = '\0';