Re: [PATCH v4 24/27] prune: strategies for linked checkouts

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

 



On 2014-03-01 13.13, Nguyễn Thái Ngọc Duy wrote:
[]
>  
> +static dev_t get_device_or_die(const char *path)
> +{
> +	struct stat buf;
> +	if (stat(path, &buf))
> +		die_errno("failed to stat '%s'", path);
> +	/* Ah Windows! Make different drives different "partitions" */
> +	if (is_windows())
> +		buf.st_dev = toupper(real_path(path)[0]);
> +	return buf.st_dev;

Is this only related to Windows ?
Do we have other file systems, which return st_dev == 0 ?
Should we check that path[0] != '/', or better !is_dir_sep(path[0]) ?
Do we need has_dos_drive_prefix() ?

As a first suggestion, would this be better:

> +	if (!buf.st_dev)
> +		buf.st_dev = toupper(real_path(path)[0]);

(End of loose thinking)
--
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]