Suppress "Not an mbox folder" error messages on empty files.

This commit is contained in:
Daniel Spiljar 2024-09-19 00:24:21 +02:00
parent 1a63374e73
commit b30f2f2362
Signed by: dspiljar
GPG Key ID: A32CE9C59D8003B5

View File

@ -132,6 +132,8 @@ mbox_open (const char *path, const char *mode)
} }
} }
memset (buffer, 0, BUFSIZ);
if (mode[0] == 'r') if (mode[0] == 'r')
{ {
if (config.format == FORMAT_MBOX) if (config.format == FORMAT_MBOX)
@ -158,13 +160,13 @@ mbox_open (const char *path, const char *mode)
if (0 != strncmp ("From ", buffer, 5)) if (0 != strncmp ("From ", buffer, 5))
{ {
if (config.merr) if ((config.merr) && (buffer[0] != '\0'))
{ {
if (0 == strcmp ("-", path)) if (0 == strcmp ("-", path))
fprintf (stderr, "%s: (standard input): Not a mbox folder\n", fprintf (stderr, "%s: (standard input): Not an mbox folder\n",
APPNAME); APPNAME);
else else
fprintf (stderr, "%s: %s: Not a mbox folder\n", APPNAME, fprintf (stderr, "%s: %s: Not an mbox folder\n", APPNAME,
path); path);
} }
if (config.format == FORMAT_MBOX) if (config.format == FORMAT_MBOX)