Commits

Anonymous committed 6f2eacf

mailsplit: allow empty input from stdin

Signed-off-by: Junio C Hamano <junkio@cox.net>

Comments (0)

Files changed (1)

 		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);