diff options
-rw-r--r-- | include/sys/fs/zfs.h | 1 | ||||
-rw-r--r-- | lib/libshare/libshare.c | 6 | ||||
-rw-r--r-- | lib/libzfs/libzfs_util.c | 5 |
3 files changed, 7 insertions, 5 deletions
diff --git a/include/sys/fs/zfs.h b/include/sys/fs/zfs.h index d1d0a275d..2a630ec53 100644 --- a/include/sys/fs/zfs.h +++ b/include/sys/fs/zfs.h @@ -917,6 +917,7 @@ typedef struct ddt_histogram { #define ZVOL_DRIVER "zvol" #define ZFS_DRIVER "zfs" #define ZFS_DEV "/dev/zfs" +#define ZFS_SHARETAB "/etc/dfs/sharetab" /* general zvol path */ #define ZVOL_DIR "/dev" diff --git a/lib/libshare/libshare.c b/lib/libshare/libshare.c index 89a4fe9aa..0eb4ae00d 100644 --- a/lib/libshare/libshare.c +++ b/lib/libshare/libshare.c @@ -113,7 +113,7 @@ parse_sharetab(sa_handle_impl_t impl_handle) { char line[512]; char *eol, *pathname, *resource, *fstype, *options, *description; - fp = fopen("/etc/dfs/sharetab", "r"); + fp = fopen(ZFS_SHARETAB, "r"); if (fp == NULL) return; @@ -170,7 +170,7 @@ update_sharetab(sa_handle_impl_t impl_handle) sa_share_impl_t impl_share; int temp_fd; FILE *temp_fp; - char tempfile[] = "/etc/dfs/sharetab.XXXXXX"; + char tempfile[] = ZFS_SHARETAB".XXXXXX"; sa_fstype_t *fstype; const char *resource; @@ -215,7 +215,7 @@ update_sharetab(sa_handle_impl_t impl_handle) fsync(temp_fd); fclose(temp_fp); - (void) rename(tempfile, "/etc/dfs/sharetab"); + (void) rename(tempfile, ZFS_SHARETAB); } typedef struct update_cookie_s { diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index ca32e7a7f..6f5dae6c3 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -863,12 +863,13 @@ libzfs_init(void) return (NULL); } - hdl->libzfs_sharetab = fopen("/etc/dfs/sharetab", "r"); + hdl->libzfs_sharetab = fopen(ZFS_SHARETAB, "r"); if (libzfs_core_init() != 0) { (void) close(hdl->libzfs_fd); (void) fclose(hdl->libzfs_mnttab); - (void) fclose(hdl->libzfs_sharetab); + if (hdl->libzfs_sharetab) + (void) fclose(hdl->libzfs_sharetab); free(hdl); return (NULL); } |