summaryrefslogtreecommitdiff
path: root/builtin-mailsplit.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin-mailsplit.c')
-rw-r--r--builtin-mailsplit.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/builtin-mailsplit.c b/builtin-mailsplit.c
index 10fa177340..46b27cdaea 100644
--- a/builtin-mailsplit.c
+++ b/builtin-mailsplit.c
@@ -170,6 +170,7 @@ static int split_mbox(const char *file, const char *dir, int allow_bare,
{
char name[PATH_MAX];
int ret = -1;
+ int peek;
FILE *f = !strcmp(file, "-") ? stdin : fopen(file, "r");
int file_done = 0;
@@ -179,6 +180,11 @@ static int split_mbox(const char *file, const char *dir, int allow_bare,
goto out;
}
+ do {
+ peek = fgetc(f);
+ } while (isspace(peek));
+ ungetc(peek, f);
+
if (fgets(buf, sizeof(buf), f) == NULL) {
/* empty stdin is OK */
if (f != stdin) {