Re: [PATCH] remove unnecessary loop

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

 



Liu Yubao <yubao.liu@xxxxxxxxx> writes:

> Here is a ugly fix, I don't hope it will be merged into git tree as it's not
> git's fault, I will file a bug report for Cygwin.

> @@ -50,9 +53,18 @@ static void prune_directory(struct dir_struct *dir, const char **pathspec, int p
>  			continue;
>  
>  		/* Existing file? We must have ignored it */
> +#ifdef __CYGWIN__
> +		/*
> +		 * On cygwin, lstat("hello", &st) returns 0 when
> +		 * "hello.exe" exists, so test with open() again.
> +		 */
> +		if (lstat(match, &st) && -1 != (fd = open(match, O_RDONLY))) {
> +			struct dir_entry *ent;
> +			close(fd);
> +#else

We have lstat() everywhere, so if we were to work this around
without (or "waiting for") a proper fix on the Cygwin side, you
would be better off wrapping the above sequence in a separate
function (say "sane_lstat()"), and do

	#ifdef __CYGWIN__
        #define lstat(a,b) sane_lstat(a,b)
        #endif

somewhere near the top of git-compat-util.h

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