diff options
author | Matthew Macy <[email protected]> | 2019-10-02 10:39:48 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2019-10-02 10:39:48 -0700 |
commit | d31277abb1db51dece836dd47628ca42c07e528c (patch) | |
tree | b2635f2c39d2315d21af445522203dffbae57851 /lib/libzfs/libzfs_util.c | |
parent | 6360e2779e47f4bf2233071b427ad522eca9bdd4 (diff) |
OpenZFS restructuring - libspl
Factor Linux specific pieces out of libspl.
Reviewed-by: Ryan Moeller <[email protected]>
Reviewed-by: Sean Eric Fagan <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Matt Macy <[email protected]>
Closes #9336
Diffstat (limited to 'lib/libzfs/libzfs_util.c')
-rw-r--r-- | lib/libzfs/libzfs_util.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index de4d8bff9..04100071d 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -1095,7 +1095,6 @@ zfs_path_to_zhandle(libzfs_handle_t *hdl, char *path, zfs_type_t argtype) { struct stat64 statbuf; struct extmnttab entry; - int ret; if (path[0] != '/' && strncmp(path, "./", strlen("./")) != 0) { /* @@ -1104,24 +1103,12 @@ zfs_path_to_zhandle(libzfs_handle_t *hdl, char *path, zfs_type_t argtype) return (zfs_open(hdl, path, argtype)); } - if (stat64(path, &statbuf) != 0) { - (void) fprintf(stderr, "%s: %s\n", path, strerror(errno)); - return (NULL); - } - /* Reopen MNTTAB to prevent reading stale data from open file */ if (freopen(MNTTAB, "r", hdl->libzfs_mnttab) == NULL) return (NULL); - while ((ret = getextmntent(hdl->libzfs_mnttab, &entry, 0)) == 0) { - if (makedevice(entry.mnt_major, entry.mnt_minor) == - statbuf.st_dev) { - break; - } - } - if (ret != 0) { + if (getextmntent(path, &entry, &statbuf) != 0) return (NULL); - } if (strcmp(entry.mnt_fstype, MNTTYPE_ZFS) != 0) { (void) fprintf(stderr, gettext("'%s': not a ZFS filesystem\n"), |