libzfs: zfs_userns: Don't leak the namespace fd
zfs_userns opens a file descriptor for the kernel to look up a namespace, but does not close it. Close the fd when we're done with it. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Allan Jude <allan@klarasystems.com> Signed-off-by: Ryan Moeller <freqlabs@FreeBSD.org> Closes #13554
This commit is contained in:
parent
482505fd42
commit
def1a401f4
|
@ -274,5 +274,7 @@ zfs_userns(zfs_handle_t *zhp, const char *nspath, int attach)
|
||||||
if ((ret = zfs_ioctl(hdl, cmd, &zc)) != 0)
|
if ((ret = zfs_ioctl(hdl, cmd, &zc)) != 0)
|
||||||
zfs_standard_error(hdl, errno, errbuf);
|
zfs_standard_error(hdl, errno, errbuf);
|
||||||
|
|
||||||
|
(void) close(zc.zc_cleanup_fd);
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue