Merge branch 'linux-have-mntent' into refs/top-bases/linux-zfs-branch

This commit is contained in:
Brian Behlendorf 2008-12-05 12:39:50 -08:00
commit b4056061b2
1 changed files with 8 additions and 0 deletions

View File

@ -566,7 +566,11 @@ libzfs_init(void)
return (NULL); return (NULL);
} }
#ifdef HAVE_SETMNTENT
if ((hdl->libzfs_mnttab = setmntent(MNTTAB, "r")) == NULL) {
#else
if ((hdl->libzfs_mnttab = fopen(MNTTAB, "r")) == NULL) { if ((hdl->libzfs_mnttab = fopen(MNTTAB, "r")) == NULL) {
#endif
(void) close(hdl->libzfs_fd); (void) close(hdl->libzfs_fd);
free(hdl); free(hdl);
return (NULL); return (NULL);
@ -585,7 +589,11 @@ libzfs_fini(libzfs_handle_t *hdl)
{ {
(void) close(hdl->libzfs_fd); (void) close(hdl->libzfs_fd);
if (hdl->libzfs_mnttab) if (hdl->libzfs_mnttab)
#ifdef HAVE_SETMNTENT
(void) endmntent(hdl->libzfs_mnttab);
#else
(void) fclose(hdl->libzfs_mnttab); (void) fclose(hdl->libzfs_mnttab);
#endif
if (hdl->libzfs_sharetab) if (hdl->libzfs_sharetab)
(void) fclose(hdl->libzfs_sharetab); (void) fclose(hdl->libzfs_sharetab);
zfs_uninit_libshare(hdl); zfs_uninit_libshare(hdl);