From: Junio C Hamano Date: Sun, 8 Jan 2006 05:26:30 +0000 (-0800) Subject: mailsplit: allow empty input from stdin X-Git-Tag: v1.0.8^2 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=6f2eacfeb2c67a7e05f98df2288d7893d3368c8e;p=git.git mailsplit: allow empty input from stdin Signed-off-by: Junio C Hamano --- diff --git a/mailsplit.c b/mailsplit.c index eb58b1eb..14c13587 100644 --- a/mailsplit.c +++ b/mailsplit.c @@ -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);