summaryrefslogtreecommitdiffstats
path: root/support/export
diff options
context:
space:
mode:
authorPavel Raiskup <praiskup@redhat.com>2014-12-03 17:10:11 -0500
committerSteve Dickson <steved@redhat.com>2014-12-03 17:10:11 -0500
commitd6ef125c4be83de1d94727bf6be74cd7c0bf424c (patch)
tree81c1a3e6975958683128ce3b25afef278d0f268a /support/export
parent72819502650d39e7791adebe737a6d04124d9ef3 (diff)
downloadnfs-utils-d6ef125c4be83de1d94727bf6be74cd7c0bf424c.tar.gz
nfs-utils-d6ef125c4be83de1d94727bf6be74cd7c0bf424c.tar.xz
nfs-utils-d6ef125c4be83de1d94727bf6be74cd7c0bf424c.zip
exportfs: warn when really nothing is exported
Throw 'No file systems exported!' iff no volume is exported rather then if some exports file is empty. Typically this can happen if the default /etc/exports file is empty and admin installed configuration into /etc/exports.d directory. This is follow-up for e725def62c73b4 commit. Signed-off-by: Pavel Raiskup <praiskup@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'support/export')
-rw-r--r--support/export/export.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/support/export/export.c b/support/export/export.c
index 30a5b4a..e1bebce 100644
--- a/support/export/export.c
+++ b/support/export/export.c
@@ -69,36 +69,30 @@ static void warn_duplicated_exports(nfs_export *exp, struct exportent *eep)
* export_read - read entries from /etc/exports
* @fname: name of file to read from
*
+ * Returns number of read entries.
*/
-void
-export_read(char *fname, int verbose)
+int
+export_read(char *fname)
{
struct exportent *eep;
nfs_export *exp;
int volumes = 0;
- int bad_entry = 0;
setexportent(fname, "r");
while ((eep = getexportent(0,1)) != NULL) {
exp = export_lookup(eep->e_hostname, eep->e_path, 0);
if (!exp) {
- exp = export_create(eep, 0);
- if (exp)
+ if (export_create(eep, 0))
+ /* possible complaints already logged */
volumes++;
- else
- bad_entry++;
}
else
warn_duplicated_exports(exp, eep);
}
endexportent();
- if (volumes == 0) {
- if (bad_entry > 0)
- xlog(L_ERROR, "No file systems exported!");
- else if (verbose)
- xlog(L_WARNING, "No file systems exported!");
- }
+
+ return volumes;
}
/**