[PATCH v2 4/4] new: Fix missing end_atomic in remove_filename on error

Mark Walters markwalters1009 at gmail.com
Sun Apr 22 00:42:34 PDT 2012


On Sun, 22 Apr 2012, Austin Clements <amdragon at MIT.EDU> wrote:
> Previously, if we failed to find the message by filename in
> remove_filename, we would return immediately from the function without
> ending its atomic block.  Now this code follows the usual goto DONE
> idiom to perform cleanup.

The whole series looks good to me modulo the return value in Patch 2/4.

Best wishes

Mark 

> ---
>  notmuch-new.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/notmuch-new.c b/notmuch-new.c
> index 2103b18..9eebea4 100644
> --- a/notmuch-new.c
> +++ b/notmuch-new.c
> @@ -779,7 +779,8 @@ remove_filename (notmuch_database_t *notmuch,
>  	return status;
>      status = notmuch_database_find_message_by_filename (notmuch, path, &message);
>      if (status || message == NULL)
> -	return status;
> +	goto DONE;
> +
>      status = notmuch_database_remove_message (notmuch, path);
>      if (status == NOTMUCH_STATUS_DUPLICATE_MESSAGE_ID) {
>  	add_files_state->renamed_messages++;
> @@ -790,6 +791,8 @@ remove_filename (notmuch_database_t *notmuch,
>  	add_files_state->removed_messages++;
>      }
>      notmuch_message_destroy (message);
> +
> +  DONE:
>      notmuch_database_end_atomic (notmuch);
>      return status;
>  }
> -- 
> 1.7.9.1
>
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list