From 9c1b2c34469383bad9c1eb026c44d5ef7107f18b Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 5 Dec 2008 10:30:31 -0800 Subject: [PATCH] Refresh linux-have-mntent --- .topdeps | 4 +--- .topmsg | 17 ++--------------- zfs/lib/libzfs/libzfs_util.c | 8 ++++++++ 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/.topdeps b/.topdeps index 607c231780..7f16cbcdd5 100644 --- a/.topdeps +++ b/.topdeps @@ -1,3 +1 @@ -gcc-branch -fix-branch -feature-branch +zfs-branch diff --git a/.topmsg b/.topmsg index e9722e1075..316808b6e4 100644 --- a/.topmsg +++ b/.topmsg @@ -1,19 +1,6 @@ From: Brian Behlendorf -Subject: [PATCH] zfs branch +Subject: [PATCH] linux have mntent -Merged result of all changes which are relevant to both Solaris -and Linux builds of the ZFS code. These are changes where there -is a reasonable chance they will be accepted upstream. - -Additionally, since this is effectively the root of the linux -ZFS tree the core linux build system is added here. This -includes autogen.sh, configure.ac, m4 macros, some scripts/*, -and makefiles for all the core ZFS components. Linux-only -features which require tweaks to the build system should appear -on the relevant topic branches. All autotools products which -result from autogen.sh are commited to the linux-configure-branch. - -This branch also contains the META, ChangeLog, AUTHORS, -README, and GIT files. +Use mount entry if HAVE_SETMNTENT defined Signed-off-by: Brian Behlendorf diff --git a/zfs/lib/libzfs/libzfs_util.c b/zfs/lib/libzfs/libzfs_util.c index 116521cb47..43d2c9a56c 100644 --- a/zfs/lib/libzfs/libzfs_util.c +++ b/zfs/lib/libzfs/libzfs_util.c @@ -566,7 +566,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); @@ -585,7 +589,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);