X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch-new.c;h=81a93500ced96e971df3562a3730e911f81819e1;hp=e79593cd092dd3345a8bac182234833ecfc92333;hb=e312705d2058247ea23767801d9783338b4470b6;hpb=bff30540d86c77aacbc2c133c83aa7ccee823b48 diff --git a/notmuch-new.c b/notmuch-new.c index e79593cd..81a93500 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -743,7 +743,9 @@ remove_filename (notmuch_database_t *notmuch, status = notmuch_database_begin_atomic (notmuch); if (status) return status; - message = notmuch_database_find_message_by_filename (notmuch, path); + status = notmuch_database_find_message_by_filename (notmuch, path, &message); + if (status || message == NULL) + return status; status = notmuch_database_remove_message (notmuch, path); if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) { add_files_state->renamed_messages++; @@ -813,6 +815,8 @@ notmuch_new_command (void *ctx, int argc, char *argv[]) add_files_state.verbose = 0; add_files_state.output_is_a_tty = isatty (fileno (stdout)); + argc--; argv++; /* skip subcommand argument */ + for (i = 0; i < argc && argv[i][0] == '-'; i++) { if (STRNCMP_LITERAL (argv[i], "--verbose") == 0) { add_files_state.verbose = 1;