summaryrefslogtreecommitdiffstats
path: root/lib/libzfs/libzfs_util.c
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2010-08-26 11:43:58 -0700
committerBrian Behlendorf <[email protected]>2010-08-31 13:41:50 -0700
commit2eadf037f5ae2735bcbc61e3bb2974c6d3235b8e (patch)
tree0f37b598c9eaecad86721593442fa13c00a17fd1 /lib/libzfs/libzfs_util.c
parentd2c15e84e9c37f9c3d10dfffc9bd6be4600bf924 (diff)
Add linux mntent support
Use mount entry if HAVE_SETMNTENT defined Signed-off-by: Brian Behlendorf <[email protected]>
Diffstat (limited to 'lib/libzfs/libzfs_util.c')
-rw-r--r--lib/libzfs/libzfs_util.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c
index 8277bdb02..cb7d87cb2 100644
--- a/lib/libzfs/libzfs_util.c
+++ b/lib/libzfs/libzfs_util.c
@@ -617,7 +617,11 @@ libzfs_init(void)
return (NULL);
}
+#ifdef HAVE_SETMNTENT
+ if ((hdl->libzfs_mnttab = setmntent(MNTTAB, "r")) == NULL) {
+#else
if ((hdl->libzfs_mnttab = fopen(MNTTAB, "r")) == NULL) {
+#endif
(void) close(hdl->libzfs_fd);
free(hdl);
return (NULL);
@@ -637,7 +641,11 @@ libzfs_fini(libzfs_handle_t *hdl)
{
(void) close(hdl->libzfs_fd);
if (hdl->libzfs_mnttab)
+#ifdef HAVE_SETMNTENT
+ (void) endmntent(hdl->libzfs_mnttab);
+#else
(void) fclose(hdl->libzfs_mnttab);
+#endif
if (hdl->libzfs_sharetab)
(void) fclose(hdl->libzfs_sharetab);
zfs_uninit_libshare(hdl);