Blame SOURCES/nfs-utils-1.3.0-exportfs-empty-exports.patch

e19a30
diff --git a/support/export/export.c b/support/export/export.c
e19a30
index ce714d4..e1bebce 100644
e19a30
--- a/support/export/export.c
e19a30
+++ b/support/export/export.c
e19a30
@@ -69,8 +69,9 @@ static void warn_duplicated_exports(nfs_export *exp, struct exportent *eep)
e19a30
  * export_read - read entries from /etc/exports
e19a30
  * @fname: name of file to read from
e19a30
  *
e19a30
+ * Returns number of read entries.
e19a30
  */
e19a30
-void
e19a30
+int
e19a30
 export_read(char *fname)
e19a30
 {
e19a30
 	struct exportent	*eep;
e19a30
@@ -82,16 +83,16 @@ export_read(char *fname)
e19a30
 	while ((eep = getexportent(0,1)) != NULL) {
e19a30
 		exp = export_lookup(eep->e_hostname, eep->e_path, 0);
e19a30
 		if (!exp) {
e19a30
-			exp = export_create(eep, 0);
e19a30
-			if (exp)
e19a30
+			if (export_create(eep, 0))
e19a30
+				/* possible complaints already logged */
e19a30
 				volumes++;
e19a30
 		}
e19a30
 		else
e19a30
 			warn_duplicated_exports(exp, eep);
e19a30
 	}
e19a30
 	endexportent();
e19a30
-	if (volumes == 0)
e19a30
-		xlog(L_ERROR, "No file systems exported!");
e19a30
+
e19a30
+	return volumes;
e19a30
 }
e19a30
 
e19a30
 /**
e19a30
diff --git a/support/include/exportfs.h b/support/include/exportfs.h
e19a30
index 97b2327..faa9f0b 100644
e19a30
--- a/support/include/exportfs.h
e19a30
+++ b/support/include/exportfs.h
e19a30
@@ -133,7 +133,7 @@ struct addrinfo *		client_resolve(const struct sockaddr *sap);
e19a30
 int 				client_member(const char *client,
e19a30
 						const char *name);
e19a30
 
e19a30
-void				export_read(char *fname);
e19a30
+int				export_read(char *fname);
e19a30
 void				export_reset(nfs_export *);
e19a30
 nfs_export *			export_lookup(char *hname, char *path, int caconical);
e19a30
 nfs_export *			export_find(const struct addrinfo *ai,
e19a30
diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
e19a30
index c06f2aa..b7d8578 100644
e19a30
--- a/utils/exportfs/exportfs.c
e19a30
+++ b/utils/exportfs/exportfs.c
e19a30
@@ -47,7 +47,7 @@ static void	error(nfs_export *exp, int err);
e19a30
 static void	usage(const char *progname, int n);
e19a30
 static void	validate_export(nfs_export *exp);
e19a30
 static int	matchhostname(const char *hostname1, const char *hostname2);
e19a30
-static void	export_d_read(const char *dname);
e19a30
+static int	export_d_read(const char *dname);
e19a30
 static void grab_lockfile(void);
e19a30
 static void release_lockfile(void);
e19a30
 
e19a30
@@ -185,8 +185,11 @@ main(int argc, char **argv)
e19a30
 	atexit(release_lockfile);
e19a30
 
e19a30
 	if (f_export && ! f_ignore) {
e19a30
-		export_read(_PATH_EXPORTS);
e19a30
-		export_d_read(_PATH_EXPORTS_D);
e19a30
+		if (! (export_read(_PATH_EXPORTS) +
e19a30
+		       export_d_read(_PATH_EXPORTS_D))) {
e19a30
+			if (f_verbose)
e19a30
+				xlog(L_WARNING, "No file systems exported!");
e19a30
+		}
e19a30
 	}
e19a30
 	if (f_export) {
e19a30
 		if (f_all)
e19a30
@@ -699,21 +702,22 @@ out:
e19a30
 
e19a30
 /* Based on mnt_table_parse_dir() in
e19a30
    util-linux-ng/shlibs/mount/src/tab_parse.c */
e19a30
-static void
e19a30
+static int
e19a30
 export_d_read(const char *dname)
e19a30
 {
e19a30
 	int n = 0, i;
e19a30
 	struct dirent **namelist = NULL;
e19a30
+	int volumes = 0;
e19a30
 
e19a30
 
e19a30
 	n = scandir(dname, &namelist, NULL, versionsort);
e19a30
 	if (n < 0) {
e19a30
 		if (errno == ENOENT)
e19a30
 			/* Silently return */
e19a30
-			return;
e19a30
+			return volumes;
e19a30
 		xlog(L_NOTICE, "scandir %s: %s", dname, strerror(errno));
e19a30
 	} else if (n == 0)
e19a30
-		return;
e19a30
+		return volumes;
e19a30
 
e19a30
 	for (i = 0; i < n; i++) {
e19a30
 		struct dirent *d = namelist[i];
e19a30
@@ -743,14 +747,14 @@ export_d_read(const char *dname)
e19a30
 			continue;
e19a30
 		}
e19a30
 
e19a30
-		export_read(fname);
e19a30
+		volumes += export_read(fname);
e19a30
 	}
e19a30
 
e19a30
 	for (i = 0; i < n; i++)
e19a30
 		free(namelist[i]);
e19a30
 	free(namelist);
e19a30
 
e19a30
-	return;
e19a30
+	return volumes;
e19a30
 }
e19a30
 
e19a30
 static char