aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Jani Nikula <jani@nikula.org>2014-09-22 11:54:53 +0200
committerGravatar David Bremner <david@tethera.net>2014-09-24 20:20:02 +0200
commit602ac49eaca08741b0586e98e9e26779c65163ca (patch)
treedd7990f8846586eb5c55209f10f9ea089238badc
parentf42e2e43a0284491c02a55e45c2cf4233b2b94f1 (diff)
cli/insert: rename check_folder_name to is_valid_folder_name
An "is something" predicate conveys the meaning better. While at it, improve the function documentation and error message. Besides the error message change, no functional changes.
-rw-r--r--notmuch-insert.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/notmuch-insert.c b/notmuch-insert.c
index 8dfc8bb9..770275bb 100644
--- a/notmuch-insert.c
+++ b/notmuch-insert.c
@@ -83,10 +83,13 @@ sync_dir (const char *dir)
return ret;
}
-/* Check the specified folder name does not contain a directory
- * component ".." to prevent writes outside of the Maildir hierarchy. */
+/*
+ * Check the specified folder name does not contain a directory
+ * component ".." to prevent writes outside of the Maildir
+ * hierarchy. Return TRUE on valid folder name, FALSE otherwise.
+ */
static notmuch_bool_t
-check_folder_name (const char *folder)
+is_valid_folder_name (const char *folder)
{
const char *p = folder;
@@ -449,8 +452,8 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
if (folder == NULL) {
maildir = db_path;
} else {
- if (! check_folder_name (folder)) {
- fprintf (stderr, "Error: bad folder name: %s\n", folder);
+ if (! is_valid_folder_name (folder)) {
+ fprintf (stderr, "Error: invalid folder name: '%s'\n", folder);
return EXIT_FAILURE;
}
maildir = talloc_asprintf (config, "%s/%s", db_path, folder);