X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=notmuch-restore.c;h=f530bb4ed9388833e91a70cecd321c9daeb521d2;hb=61f0a5b8ee2adf540106a09c5f83fe634da6beb3;hp=f095f64a76b7054dbda62b1fd8f9f4efa975117b;hpb=bb74e9dff80e64734308d5997c756fd96d041235;p=notmuch diff --git a/notmuch-restore.c b/notmuch-restore.c index f095f64a..f530bb4e 100644 --- a/notmuch-restore.c +++ b/notmuch-restore.c @@ -44,6 +44,8 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[]) synchronize_flags = notmuch_config_get_maildir_synchronize_flags (config); + argc--; argv++; /* skip subcommand argument */ + if (argc) { input = fopen (argv[0], "r"); if (input == NULL) { @@ -87,10 +89,13 @@ notmuch_restore_command (unused (void *ctx), int argc, char *argv[]) file_tags = xstrndup (line + match[2].rm_so, match[2].rm_eo - match[2].rm_so); - message = notmuch_database_find_message (notmuch, message_id); - if (message == NULL) { - fprintf (stderr, "Warning: Cannot apply tags to missing message: %s\n", - message_id); + status = notmuch_database_find_message (notmuch, message_id, &message); + if (status || message == NULL) { + fprintf (stderr, "Warning: Cannot apply tags to %smessage: %s\n", + message ? "" : "missing ", message_id); + if (status) + fprintf (stderr, "%s\n", + notmuch_status_to_string(status)); goto NEXT_LINE; }