Re: [PATCH 3/4] difftool: use a strbuf to create the tmpdir path

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

 



On Sat, Sep 18, 2021 at 06:57:28PM -0700, David Aguilar wrote:

> +	/* Remove trailing slashes when $TMPDIR ends in '/'. */
> +	while (tmpdir.len > 0 && tmpdir.buf[tmpdir.len - 1] == '/') {
> +		strbuf_setlen(&tmpdir, tmpdir.len - 1);
> +	}
> +	strbuf_addstr(&tmpdir, "/git-difftool.XXXXXX");

It sounds like this should remove any directory separator (so on
Windows, it should also drop backslashes). You can use is_dir_sep() for
that, but better still, you can then do:

  strbuf_trim_trailing_dir_sep(&tmpdir);

-Peff



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

  Powered by Linux