Skip to content

Commit 6f2eacf

Browse files
author
Junio C Hamano
committed
mailsplit: allow empty input from stdin
Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 013049c commit 6f2eacf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mailsplit.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,11 @@ int main(int argc, const char **argv)
169169
if ( !f )
170170
die ("cannot open mbox %s", file);
171171

172-
if (fgets(buf, sizeof(buf), f) == NULL)
172+
if (fgets(buf, sizeof(buf), f) == NULL) {
173+
if (f == stdin)
174+
break; /* empty stdin is OK */
173175
die("cannot read mbox %s", file);
176+
}
174177

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

0 commit comments

Comments
 (0)