Re: [REGRESSION] Interrupted clone/fetch leaves .lock files around

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonas Fonseca <fonseca@xxxxxxx> wrote Tue, Jun 06, 2006:
> Below is my feeble attempt at a (tested) fix.

Ok, so maybe I didn't test it so well, other than continuously
interrupting the fetch. ;)
 
> diff --git a/fetch.c b/fetch.c
> index e040ef9..861dc60 100644
> --- a/fetch.c
> +++ b/fetch.c
> @@ -214,9 +216,19 @@ static int mark_complete(const char *pat
>  	return 0;
>  }
>  
> +static struct ref_lock *lock = NULL;
> +
> +static void remove_lockfile_on_signal(int signo)
> +{
> +	if (lock)
> +		unlock_ref(lock);
> +	lock = NULL;
> +	signal(SIGINT, SIG_DFL);
> +	raise(signo);
> +}
> +
>  int pull(char *target)
>  {
> -	struct ref_lock *lock = NULL;
>  	unsigned char sha1[20];
>  	char *msg;
>  	int ret;
...
> @@ -261,6 +263,10 @@ int pull(char *target)
>  		if (msg)
>  			free(msg);
>  		return ret;
> +	} else {
> +		return 0;
>  	}
> -	return 0;
> +
> +	remove_lockfile_on_signal(0);

This will end up calling raise().

> +	return -1;
>  }

-- 
Jonas Fonseca
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]