summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2022-11-12 10:12:07 -0800
committerKevin McCarthy <kevin@8t8.us>2022-11-12 10:13:44 -0800
commit99bd9a53d97e0f163c0a65c01ee8ea6a7255695a (patch)
tree21d4ef771114a5e7e8f95b48986b9aec8faafd14
parent3c0f85979d53525c3e915d35157f9be156e96055 (diff)
wip: untested. improve mx_is_maildir check.kevin/stable-mx-maildir-check-fix
-rw-r--r--mh.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/mh.c b/mh.c
index 818dbdb5..1ae739e6 100644
--- a/mh.c
+++ b/mh.c
@@ -2738,10 +2738,22 @@ int mx_is_maildir (const char *path)
int rc = 0;
tmp = mutt_buffer_pool_get ();
+
mutt_buffer_printf (tmp, "%s/cur", path);
- if (stat (mutt_b2s (tmp), &st) == 0 && S_ISDIR (st.st_mode))
- rc = 1;
+ if (stat (mutt_b2s (tmp), &st) != 0 || !S_ISDIR (st.st_mode))
+ goto out;
+
+ mutt_buffer_printf (tmp, "%s/new", path);
+ if (stat (mutt_b2s (tmp), &st) != 0 || !S_ISDIR (st.st_mode))
+ goto out;
+ mutt_buffer_printf (tmp, "%s/tmp", path);
+ if (stat (mutt_b2s (tmp), &st) != 0 || !S_ISDIR (st.st_mode))
+ goto out;
+
+ rc = 1;
+
+out:
mutt_buffer_pool_release (&tmp);
return rc;
}