mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-23 01:44:52 +01:00
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.
This commit is contained in:
parent
f42e2e43a0
commit
602ac49eac
1 changed files with 8 additions and 5 deletions
|
@ -83,10 +83,13 @@ sync_dir (const char *dir)
|
||||||
return ret;
|
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
|
static notmuch_bool_t
|
||||||
check_folder_name (const char *folder)
|
is_valid_folder_name (const char *folder)
|
||||||
{
|
{
|
||||||
const char *p = folder;
|
const char *p = folder;
|
||||||
|
|
||||||
|
@ -449,8 +452,8 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
|
||||||
if (folder == NULL) {
|
if (folder == NULL) {
|
||||||
maildir = db_path;
|
maildir = db_path;
|
||||||
} else {
|
} else {
|
||||||
if (! check_folder_name (folder)) {
|
if (! is_valid_folder_name (folder)) {
|
||||||
fprintf (stderr, "Error: bad folder name: %s\n", folder);
|
fprintf (stderr, "Error: invalid folder name: '%s'\n", folder);
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
maildir = talloc_asprintf (config, "%s/%s", db_path, folder);
|
maildir = talloc_asprintf (config, "%s/%s", db_path, folder);
|
||||||
|
|
Loading…
Reference in a new issue