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

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