Re: [PATCH] http-push: remove remote locks on exit signals
- From
Junio C Hamano <junio@pobox.com>
- Date
- May 23, 2008, 21:40 UTC
- Message-ID
- <7vod6wr95y.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <20080522195546.GA29911@localhost>
Clemens Buchacher <drizzd@aon.at> writes:
Show 26 quoted lines
> diff --git a/http-push.c b/http-push.c
> index 5b23038..b1f5302 100644
> --- a/http-push.c
> +++ b/http-push.c
> @@ -1349,6 +1349,24 @@ static int unlock_remote(struct remote_lock *lock)
> return rc;
> }
>
> +static void remove_locks(void)
> +{
> + struct remote_lock *lock = remote->locks;
> +
> + fprintf(stderr, "Removing remote locks...\n");
> + while (lock) {
> + unlock_remote(lock);
> + lock = lock->next;
> + }
> +}
> +
> +static void remove_locks_on_signal(int signo)
> +{
> + remove_locks();
> + signal(SIGINT, SIG_DFL);
> + raise(signo);
> +}
> +If you caught signo, shouldn't you be resetting that signo not SIGINT?
Show 9 quoted lines
> static void remote_ls(const char *path, int flags, > void (*userFunc)(struct remote_ls_ctx *ls), > void *userData); > @@ -2255,6 +2273,8 @@ int main(int argc, char **argv) > goto cleanup; > } > > + signal(SIGINT, remove_locks_on_signal); > +
and you may care more than just INT but perhaps HUP and others?
> /* Check whether the remote has server info files */
> remote->can_update_info_refs = 0;
> remote->has_info_refs = remote_exists("info/refs");Having said that, I do not use http-push myself, so I'll wait for others who do use it to comment on this; success reports are welcomed, reports on bad side effects, if any, are even more appreciated.