diff options
author | наб <[email protected]> | 2021-05-17 19:56:48 +0200 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2021-12-17 12:54:00 -0800 |
commit | 4e225e7316d5e65dcfd2694e79930400740b7260 (patch) | |
tree | b00b0c571ae1ba982113473fcbbe5a27d97587ec /lib/libshare/os/linux | |
parent | c53f2e9b5086051a9aede27254a109983443e557 (diff) |
libshare: nfs: share nfs_copy_entries()
Reviewed-by: Don Brady <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: John Kennedy <[email protected]>
Signed-off-by: Ahelenia Ziemiańska <[email protected]>
Closes #12067
Diffstat (limited to 'lib/libshare/os/linux')
-rw-r--r-- | lib/libshare/os/linux/nfs.c | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/lib/libshare/os/linux/nfs.c b/lib/libshare/os/linux/nfs.c index bf3729141..7f8ebd7f6 100644 --- a/lib/libshare/os/linux/nfs.c +++ b/lib/libshare/os/linux/nfs.c @@ -420,60 +420,6 @@ nfs_add_entry(FILE *tmpfile, const char *sharepath, } /* - * This function copies all entries from the exports file to newfp, - * omitting any entries for the specified mountpoint. - */ -int -nfs_copy_entries(FILE *newfp, const char *mountpoint) -{ - char *buf = NULL; - size_t buflen = 0; - int error = SA_OK; - - FILE *oldfp = fopen(ZFS_EXPORTS_FILE, "re"); - fputs(FILE_HEADER, newfp); - - /* - * The ZFS_EXPORTS_FILE may not exist yet. If that's the - * case then just write out the new file. - */ - if (oldfp != NULL) { - while (getline(&buf, &buflen, oldfp) != -1) { - char *space = NULL; - - if (buf[0] == '\n' || buf[0] == '#') - continue; - - if ((space = strchr(buf, ' ')) != NULL) { - int mountpoint_len = strlen(mountpoint); - - if (space - buf == mountpoint_len && - strncmp(mountpoint, buf, - mountpoint_len) == 0) { - continue; - } - } - fputs(buf, newfp); - } - - if (ferror(oldfp) != 0) { - error = ferror(oldfp); - } - if (fclose(oldfp) != 0) { - fprintf(stderr, "Unable to close file %s: %s\n", - ZFS_EXPORTS_FILE, strerror(errno)); - error = error != 0 ? error : SA_SYSTEM_ERR; - } - } - - if (error == SA_OK && ferror(newfp) != 0) - error = ferror(newfp); - - free(buf); - return (error); -} - -/* * Enables NFS sharing for the specified share. */ static int |