]> granicus.if.org Git - neomutt/commitdiff
mx_path_probe: export stat info
authorRichard Russon <rich@flatcap.org>
Fri, 28 Sep 2018 18:46:57 +0000 (19:46 +0100)
committerRichard Russon <rich@flatcap.org>
Fri, 28 Sep 2018 22:51:56 +0000 (23:51 +0100)
mx.c
mx.h

diff --git a/mx.c b/mx.c
index fde6e2ee4edc22ca7921e00616d39ff8422d5784..4dd266980a36ec0b0c46a3f9c8c2348928e00084 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -1330,11 +1330,11 @@ bool mx_tags_is_supported(struct Context *ctx)
 
 /**
  * mx_path_probe - Find a mailbox that understands a path
- * @param path  Path to examine
- * @param st    stat buffer (for local filesystems)
+ * @param[in]  path  Path to examine
+ * @param[out] st    stat buffer (OPTIONAL, for local filesystems)
  * @retval num Type, e.g. #MUTT_IMAP
  */
-int mx_path_probe(const char *path, const struct stat *st)
+int mx_path_probe(const char *path, struct stat *st)
 {
   if (!path)
     return MUTT_UNKNOWN;
@@ -1372,13 +1372,12 @@ int mx_path_probe(const char *path, const struct stat *st)
 
   struct stat st2 = { 0 };
   if (!st)
-  {
     st = &st2;
-    if (stat(path, &st2) != 0)
-    {
-      mutt_debug(1, "unable to stat %s: %s (errno %d).\n", path, strerror(errno), errno);
-      return MUTT_UNKNOWN;
-    }
+
+  if (stat(path, st) != 0)
+  {
+    mutt_debug(1, "unable to stat %s: %s (errno %d).\n", path, strerror(errno), errno);
+    return MUTT_UNKNOWN;
   }
 
   for (size_t i = 0; i < mutt_array_size(with_stat); i++)
diff --git a/mx.h b/mx.h
index 3cba5c200672ff573e3a4ab0fa47de1da1ca7a79..a2fab1916a0e284ddc7e204cf470ae2d585da98f 100644 (file)
--- a/mx.h
+++ b/mx.h
@@ -246,7 +246,7 @@ int             mx_msg_padding_size(struct Context *ctx);
 int             mx_path_canon      (char *buf, size_t buflen, const char *folder);
 int             mx_path_parent     (char *buf, size_t buflen);
 int             mx_path_pretty     (char *buf, size_t buflen, const char *folder);
-int             mx_path_probe      (const char *path, const struct stat *st);
+int             mx_path_probe      (const char *path, struct stat *st);
 int             mx_tags_commit     (struct Context *ctx, struct Email *e, char *tags);
 int             mx_tags_edit       (struct Context *ctx, const char *tags, char *buf, size_t buflen);