Re: [PATCH 26/48] merge-recursive: Allow make_room_for_path() to remove D/F entries

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

 



Am 6/8/2011 9:30, schrieb Elijah Newren:
> +static int make_room_for_path(const struct merge_options *o, const char *path)
>  {
> -	int status;
> +	int status, i;
>  	const char *msg = "failed to create path '%s'%s";
>  
> +	/* Unlink any D/F conflict files that are in the way */
> +	for (i = 0; i < o->df_conflict_file_set.nr; i++) {
> +		const char *df_path = o->df_conflict_file_set.items[i].string;
> +		size_t pathlen = strlen(path);
> +		size_t df_pathlen = strlen(df_path);
> +		if (df_pathlen < pathlen && strncmp(path, df_path, df_pathlen) == 0) {
> +			unlink(df_path);
> +			break;
> +		}
> +	}

Each time this loop is entered it tries to remove the same path again,
even if it does not exist anymore or was morphed into a directory in the
meantime. I suggest to remove a path from o->df_conflict_file_set after it
was unlinked. Or even better: have a separate "make room" phase somewhere
in the merge process.

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