On Fri, Feb 23, 2018 at 04:40:45PM +0900, Misono, Tomohiro wrote:
> 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.
Good catch, fixed.
--
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