Re: [PATCH 2/3] btrfs-progs: separate the overwrite check.

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

 



On Thu, Apr 23, 2015 at 12:51:33PM -0400, Dan Merillat wrote:
> +/* returns:
> + *  0 if the file exists and should be skipped.
> + *  1 if the file does NOT exist
> + *  2 if the file exists but is OK to overwrite
> + */
> +
> +static int overwrite_ok(const char * path)
> +{
> +	static int warn = 0;
> +	struct stat st;
> +	int ret;
> +
> +	/* don't be fooled by symlinks */
> +	ret = fstatat(-1, path_name, &st, AT_SYMLINK_NOFOLLOW);

Is the filedescriptor -1 correct? Previously, stat was used that uses
AT_FDCWD for the dirfd, which is -100. -1 could be intepreted as a bad
filedescriptor (EBADF).
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux