]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/mountd/v4root.c
4set_root: force "fsid=0" for all exports of '/'
[nfs-utils.git] / utils / mountd / v4root.c
index c33a5a9eb79d690580e81825de197d799d214ded..b4fdcce611d1fe3e6e7662d8731dc87693e58224 100644 (file)
@@ -83,7 +83,7 @@ v4root_create(char *path, nfs_export *export)
        struct exportent *curexp = &export->m_export;
 
        dupexportent(&eep, &pseudo_root.m_export);
-       eep.e_hostname = strdup(curexp->e_hostname);
+       eep.e_hostname = curexp->e_hostname;
        strncpy(eep.e_path, path, sizeof(eep.e_path));
        if (strcmp(path, "/") != 0)
                eep.e_flags &= ~NFSEXP_FSID;
@@ -192,6 +192,13 @@ v4root_set()
                                 */
                                continue;
 
+                       if (strcmp(exp->m_export.e_path, "/") == 0 &&
+                           !(exp->m_export.e_flags & NFSEXP_FSID)) {
+                               /* Force '/' to be exported as fsid == 0*/
+                               exp->m_export.e_flags |= NFSEXP_FSID;
+                               exp->m_export.e_fsid = 0;
+                       }
+
                        v4root_add_parents(exp);
                        /* XXX: error handling! */
                }