return 0;
}
+static int v4root_add_parents(nfs_export *exp)
+{
+ char *hostname = exp->m_export.e_hostname;
+ char *path;
+ char *ptr;
+
+ path = strdup(exp->m_export.e_path);
+ if (!path)
+ return -ENOMEM;
+ for (ptr = path + 1; ptr; ptr = strchr(ptr, '/')) {
+ int ret;
+ char saved;
+
+ saved = *ptr;
+ *ptr = '\0';
+ ret = pseudofs_update(hostname, path, exp);
+ if (ret)
+ return ret;
+ *ptr = saved;
+ ptr++;
+ }
+ free(path);
+ return 0;
+}
+
/*
* Create pseudo exports by running through the real export
* looking at the components of the path that make up the export.
v4root_set()
{
nfs_export *exp;
- int i;
- char *path, *ptr;
- char *hostname;
+ int i, ret;
if (!v4root_needed)
return;
for (i = 0; i < MCL_MAXTYPES; i++) {
for (exp = exportlist[i].p_head; exp; exp = exp->m_next) {
- hostname = exp->m_export.e_hostname;
-
if (exp->m_export.e_flags & NFSEXP_V4ROOT)
/*
* We just added this one, so its
*/
continue;
- path = strdup(exp->m_export.e_path);
- for (ptr = path + 1; ptr; ptr = strchr(ptr, '/')) {
- int ret;
- char saved;
-
- saved = *ptr;
- *ptr = '\0';
- ret = pseudofs_update(hostname, path, exp);
- /* XXX: error handling */
- *ptr = saved;
- ptr++;
- }
- free(path);
+ ret = v4root_add_parents(exp);
+ /* XXX: error handling! */
}
}
}