Re: [PATCH 2/2] builtin git-mv: support moving directories

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

 



This might have been fixed already (my tree is a couple of days old),
but the strcat fails for me, because the alloced memory is not
cleared.

Johannes Schindelin writes:
 > +static const char *add_slash(const char *path)
 > +{
 > +	int len = strlen(path);
 > +	if (path[len - 1] != '/') {
 > +		char *with_slash = xmalloc(len + 2);
 > +		memcpy(with_slash, path, len);
 > +		strcat(with_slash + len, "/");
 > +		return with_slash;
 > +	}
 > +	return path;
 > +}

perhaps morph the strcat into a memcopy or append the slash and the
NUL manually?

  jr

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