Re: [PATCH v2 11/27] libbtrfsutil: add subvolume iterator helpers

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

 



On 2018/02/16 4:04, Omar Sandoval wrote:
> From: Omar Sandoval <osandov@xxxxxx>

> +PUBLIC enum btrfs_util_error btrfs_util_create_subvolume_iterator(const char *path,
> +								  uint64_t top,
> +								  int flags,
> +								  struct btrfs_util_subvolume_iterator **ret)
> +{
> +	enum btrfs_util_error err;
> +	int fd;
> +
> +	fd = open(path, O_RDONLY);
> +	if (fd == -1)
> +		return BTRFS_UTIL_ERROR_OPEN_FAILED;
> +
> +	err = btrfs_util_create_subvolume_iterator_fd(fd, top, flags, ret);
> +	if (err == BTRFS_UTIL_OK)
> +		(*ret)->flags |= BTRFS_UTIL_SUBVOLUME_ITERATOR_CLOSE_FD;

If btrfs_util_create_subvolume_iterator_fd() returns error, 'fd' remains open.
So, fd should be closed here.

> +
> +	return err;
> +}

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