The unixfd IO manager didn't create the fd that was passed in, so it
should not close the fd when the io channel closes.
Cc: <linux-ext4@vger.kernel.org> # v1.43.2
Fixes: 4ccf9e4fe165cf ("libext2fs: add unixfd_io_manager")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
cleanup:
if (data) {
- if (data->dev >= 0)
+ if (io->manager != unixfd_io_manager && data->dev >= 0)
close(data->dev);
if (data->cache) {
free_cache(data);
retval = flush_cached_blocks(channel, data, 0);
#endif
- if (close(data->dev) < 0)
+ if (channel->manager != unixfd_io_manager && close(data->dev) < 0)
retval = errno;
free_cache(data);
free(data->cache);