mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-26 12:12:13 +03:00
libzfs{,_core}: set O_CLOEXEC on persistent (ZFS_DEV and MNTTAB) fds
These were fd 3, 4, and 5 by the time zfs change-key hit execute_key_fob() glibc appends "e" to setmntent() mode, but musl's just returns fopen() Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #11866
This commit is contained in:
@@ -811,7 +811,7 @@ libzfs_mnttab_update(libzfs_handle_t *hdl)
|
||||
struct mnttab entry;
|
||||
|
||||
/* Reopen MNTTAB to prevent reading stale data from open file */
|
||||
if (freopen(MNTTAB, "r", hdl->libzfs_mnttab) == NULL)
|
||||
if (freopen(MNTTAB, "re", hdl->libzfs_mnttab) == NULL)
|
||||
return (ENOENT);
|
||||
|
||||
while (getmntent(hdl->libzfs_mnttab, &entry) == 0) {
|
||||
@@ -882,7 +882,7 @@ libzfs_mnttab_find(libzfs_handle_t *hdl, const char *fsname,
|
||||
libzfs_mnttab_fini(hdl);
|
||||
|
||||
/* Reopen MNTTAB to prevent reading stale data from open file */
|
||||
if (freopen(MNTTAB, "r", hdl->libzfs_mnttab) == NULL)
|
||||
if (freopen(MNTTAB, "re", hdl->libzfs_mnttab) == NULL)
|
||||
return (ENOENT);
|
||||
|
||||
srch.mnt_special = (char *)fsname;
|
||||
|
||||
Reference in New Issue
Block a user