Skip to content

Commit

Permalink
mailsplit: allow empty input from stdin
Browse files Browse the repository at this point in the history
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Jan 8, 2006
1 parent 013049c commit 6f2eacf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mailsplit.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,11 @@ int main(int argc, const char **argv)
if ( !f )
die ("cannot open mbox %s", file);

if (fgets(buf, sizeof(buf), f) == NULL)
if (fgets(buf, sizeof(buf), f) == NULL) {
if (f == stdin)
break; /* empty stdin is OK */
die("cannot read mbox %s", file);
}

while (!file_done) {
sprintf(name, "%s/%0*d", dir, nr_prec, ++nr);
Expand Down

0 comments on commit 6f2eacf

Please sign in to comment.