X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Finc.c;h=5f08df4598ffb3e047714b3582e66e2eec42c4f1;hp=f08fb4f3df169a5e94f0acf23c9616b61bdb05f0;hb=a87df3543d3bc128ba4079d1f95638476ba5ca50;hpb=43ae44731bc0732c894ba6dc7de2d2881c5888e0 diff --git a/uip/inc.c b/uip/inc.c index f08fb4f..5f08df4 100644 --- a/uip/inc.c +++ b/uip/inc.c @@ -358,10 +358,25 @@ main(int argc, char **argv) fflush(stdout); } + /* check if readable and nonempty */ + if (!fgets(buf, sizeof(buf), in)) { + if (ferror(in)) { + advise("read", "unable to"); + incerr = SCNFAT; + } else { + incerr = SCNEOF; + } + goto giveup; + } + if (strncmp("From ", buf, 5)!=0) { + advise(NULL, "not in mbox format"); + incerr = SCNFAT; + goto giveup; + } + /* ** Get the mail from file (usually mail spool) */ - thisisanmbox(in); hghnum = msgnum = mp->hghmsg; for (;;) { /* @@ -429,6 +444,7 @@ main(int argc, char **argv) */ break; } +giveup:; free(maildir_copy); if (incerr < 0) { /* error */