Re: [PATCH v2] Fix safe_create_leading_directories() for Windows

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

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> This has a bit of conflict with another topic in flight; I think I
> resolved it correctly, but please double check.  The following is
> how it would apply on top of 'pu'.
>
>  sha1_file.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/sha1_file.c b/sha1_file.c
> index 131ca97..9e686eb 100644
> --- a/sha1_file.c
> +++ b/sha1_file.c
> @@ -113,11 +113,12 @@ int safe_create_leading_directories(char *path)
>  
>  	while (!retval && next_component) {
>  		struct stat st;
> -		char *slash = strchr(next_component, '/');
> -
> -		if (!slash)
> +		char *slash = next_component;
> +		while (!is_dir_sep(*slash))

Gaah; we need to check for the end of string here, i.e.

		while (*slash && !is_dir_sep(*slash))

will be what I'll queue on 'pu' for today.

> +			++slash;
> +		if (!*slash)
>  			return 0;
> -		while (*(slash + 1) == '/')
> +		while (is_dir_sep(*(slash + 1)))
>  			slash++;
>  		next_component = slash + 1;
>  		if (!*next_component)
--
To unsubscribe from this list: 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]