summaryrefslogtreecommitdiffstats
path: root/lib/libzfs/libzfs_mount.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libzfs/libzfs_mount.c')
-rw-r--r--lib/libzfs/libzfs_mount.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c
index 3cd6406b2..b85c5d04f 100644
--- a/lib/libzfs/libzfs_mount.c
+++ b/lib/libzfs/libzfs_mount.c
@@ -1165,7 +1165,10 @@ zpool_disable_datasets(zpool_handle_t *zhp, boolean_t force)
namelen = strlen(zhp->zpool_name);
- rewind(hdl->libzfs_mnttab);
+ /* Reopen MNTTAB to prevent reading stale data from open file */
+ if (freopen(MNTTAB, "r", hdl->libzfs_mnttab) == NULL)
+ return (ENOENT);
+
used = alloc = 0;
while (getmntent(hdl->libzfs_mnttab, &entry) == 0) {
/*