From: markus schnalke Date: Tue, 10 Apr 2012 22:05:26 +0000 (+0200) Subject: Scanning an empty mbox file is no error. X-Git-Tag: mmh-thesis-end~106 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=d50bc5836dcb94dc6b92e7953c7d0cf62469ee52;p=mmh Scanning an empty mbox file is no error. Of course there won't be a delimiter, but mail drop files are frequently empty, though existing. This solution is more of a hack, but it works. Improvements welcome! --- diff --git a/sbr/m_getfld.c b/sbr/m_getfld.c index c7f4279..5bd6bbb 100644 --- a/sbr/m_getfld.c +++ b/sbr/m_getfld.c @@ -575,11 +575,16 @@ void thisisanmbox(FILE *iob) { register int c; - register long pos; char text[10]; register char *cp; register char *delimstr; + c = getc(iob); + if (feof(iob)) { + return; + } + ungetc(c, iob); + /* ** Figure out what the message delimitter string is for this ** maildrop. (This used to be part of m_Eom but I didn't like @@ -592,7 +597,6 @@ thisisanmbox(FILE *iob) ** abort. */ - pos = ftell(iob); if (fread(text, sizeof(*text), 5, iob) != 5) { adios(NULL, "Read error"); }