]> granicus.if.org Git - neomutt/commitdiff
mbox: allow non-file mailboxes
authorRichard Russon <rich@flatcap.org>
Fri, 21 Dec 2018 16:54:46 +0000 (16:54 +0000)
committerRichard Russon <rich@flatcap.org>
Fri, 21 Dec 2018 16:54:47 +0000 (16:54 +0000)
We disallow directories, but allow files or other devices.
This means we can run `neomutt -f /dev/null` again.

mbox/mbox.c

index cca4a607e663977c25301d041c607e38d6bca1b0..f003fc44e82081fa5a6c0f7b9f32e76aed237372 100644 (file)
@@ -1632,11 +1632,14 @@ static int mbox_msg_padding_size(struct Mailbox *m)
  */
 enum MailboxType mbox_path_probe(const char *path, const struct stat *st)
 {
-  if (!path)
+  if (!path || !st)
     return MUTT_UNKNOWN;
 
-  if (!st || !S_ISREG(st->st_mode))
+  if (S_ISDIR(st->st_mode))
+  {
+    mutt_error("%s is not a mailbox", path);
     return MUTT_UNKNOWN;
+  }
 
   if (st->st_size == 0)
     return MUTT_MBOX;