public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <junio@pobox•com>
To: Clemens Buchacher <drizzd@aon•at>
Cc: git@vger•kernel.org
Subject: Re: [PATCH] http-push: remove remote locks on exit signals
Date: Fri, 23 May 2008 14:40:41 -0700	[thread overview]
Message-ID: <7vod6wr95y.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20080522195546.GA29911@localhost> (Clemens Buchacher's message of "Thu, 22 May 2008 21:55:46 +0200")

Clemens Buchacher <drizzd@aon•at> writes:

> 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?

>  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.

  reply	other threads:[~2008-05-23 21:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-22 19:55 [PATCH] http-push: remove remote locks on exit signals Clemens Buchacher
2008-05-23 21:40 ` Junio C Hamano [this message]
2008-05-23 22:17   ` Clemens Buchacher
2008-05-25 18:26     ` [PATCH] Reset the signal being handled Clemens Buchacher
2008-05-26  9:34       ` Johannes Schindelin
2008-05-26 19:35         ` [PATCH] lockfile: reset the correct signal Clemens Buchacher
2008-05-26 21:36           ` Johannes Schindelin
2008-05-27  7:49             ` Clemens Buchacher
2008-05-25 18:27     ` [PATCH] http-push: remove remote locks on exit signals Clemens Buchacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vod6wr95y.fsf@gitster.siamese.dyndns.org \
    --to=junio@pobox$(echo .)com \
    --cc=drizzd@aon$(echo .)at \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox