diff options
author | Kevin McCarthy <kevin@8t8.us> | 2022-11-12 10:12:07 -0800 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2022-11-12 10:13:44 -0800 |
commit | 99bd9a53d97e0f163c0a65c01ee8ea6a7255695a (patch) | |
tree | 21d4ef771114a5e7e8f95b48986b9aec8faafd14 | |
parent | 3c0f85979d53525c3e915d35157f9be156e96055 (diff) |
wip: untested. improve mx_is_maildir check.kevin/stable-mx-maildir-check-fix
-rw-r--r-- | mh.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -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; } |