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

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