Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 18EC9431FBC for ; Tue, 5 Aug 2014 00:24:00 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hBmI7itpaxKB for ; Tue, 5 Aug 2014 00:23:52 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id B2403431FAE for ; Tue, 5 Aug 2014 00:23:52 -0700 (PDT) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id 4016C100051; Tue, 5 Aug 2014 10:23:42 +0300 (EEST) From: Tomi Ollila To: Austin Clements , notmuch@notmuchmail.org Subject: Re: [PATCH] new: Report and abort on upgrade failure In-Reply-To: <1407202186-3968-1-git-send-email-amdragon@mit.edu> References: <1407202186-3968-1-git-send-email-amdragon@mit.edu> User-Agent: Notmuch/0.18.1+25~gdaf4b6f (http://notmuchmail.org) Emacs/24.3.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Aug 2014 07:24:00 -0000 On Tue, Aug 05 2014, Austin Clements wrote: > Previously the return status of notmuch_database_upgrade went > completely unchecked. > --- LGTM. Tomi > notmuch-new.c | 15 +++++++++++---- > 1 file changed, 11 insertions(+), 4 deletions(-) > > diff --git a/notmuch-new.c b/notmuch-new.c > index b7590a8..ddf42c1 100644 > --- a/notmuch-new.c > +++ b/notmuch-new.c > @@ -923,6 +923,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[]) > notmuch_bool_t timer_is_active = FALSE; > notmuch_bool_t no_hooks = FALSE; > notmuch_bool_t quiet = FALSE, verbose = FALSE; > + notmuch_status_t status; > > add_files_state.verbosity = VERBOSITY_NORMAL; > add_files_state.debug = FALSE; > @@ -1019,9 +1020,16 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[]) > } > > gettimeofday (&add_files_state.tv_start, NULL); > - notmuch_database_upgrade (notmuch, > - add_files_state.verbosity >= VERBOSITY_NORMAL ? upgrade_print_progress : NULL, > - &add_files_state); > + status = notmuch_database_upgrade ( > + notmuch, > + add_files_state.verbosity >= VERBOSITY_NORMAL ? upgrade_print_progress : NULL, > + &add_files_state); > + if (status) { > + printf ("Upgrade failed: %s\n", > + notmuch_status_to_string (status)); > + notmuch_database_destroy (notmuch); > + return EXIT_FAILURE; > + } > if (add_files_state.verbosity >= VERBOSITY_NORMAL) > printf ("Your notmuch database has now been upgraded.\n"); > } > @@ -1090,7 +1098,6 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[]) > } > > for (f = add_files_state.directory_mtimes->head; f && !interrupted; f = f->next) { > - notmuch_status_t status; > notmuch_directory_t *directory; > status = notmuch_database_get_directory (notmuch, f->filename, &directory); > if (status == NOTMUCH_STATUS_SUCCESS && directory) { > -- > 2.0.0 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch