From 99bd9a53d97e0f163c0a65c01ee8ea6a7255695a Mon Sep 17 00:00:00 2001 From: Kevin McCarthy Date: Sat, 12 Nov 2022 10:12:07 -0800 Subject: wip: untested. improve mx_is_maildir check. --- mh.c | 16 ++++++++++++++-- 1 file 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; } -- cgit v1.2.3