aboutsummaryrefslogtreecommitdiff
path: root/mailsplit.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-01-07 21:26:30 -0800
committerJunio C Hamano <junkio@cox.net>2006-01-07 21:26:30 -0800
commit6f2eacfeb2c67a7e05f98df2288d7893d3368c8e (patch)
tree99a28e9b0cb68552be8162f60539254e3984a4eb /mailsplit.c
parent013049c985e4095106e545559c17bc594d56468d (diff)
downloadgit-6f2eacfeb2c67a7e05f98df2288d7893d3368c8e.tar.gz
git-6f2eacfeb2c67a7e05f98df2288d7893d3368c8e.tar.xz
mailsplit: allow empty input from stdin
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'mailsplit.c')
-rw-r--r--mailsplit.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mailsplit.c b/mailsplit.c
index eb58b1ebe..14c135873 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);