nfs-utils/exportfs-report-failure-if-asked-to-unexport-somethi.patch

41 lines
1.1 KiB
Diff
Raw Normal View History

From 609bce0c7efde1875d1477d96fe1f359b6403005 Mon Sep 17 00:00:00 2001
From: Neil Brown <neilb@suse.de>
Date: Mon, 28 Oct 2013 14:40:15 +1100
Subject: [PATCH] exportfs: report failure if asked to unexport something not
exported.
Reference: bnc#846064
Currently if exportfs is asked to unexport something that is not
exported it silently succeeds. This is not ideal, particularly for
scripting situations.
So report an error unless the unexport was successful.
Reported-by: Tony Asleson <tasleson@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
---
utils/exportfs/exportfs.c | 4 ++++
1 file changed, 4 insertions(+)
--- nfs-utils-1.2.8.orig/utils/exportfs/exportfs.c
+++ nfs-utils-1.2.8/utils/exportfs/exportfs.c
@@ -345,6 +345,7 @@ unexportfs(char *arg, int verbose)
char *path;
char *hname = arg;
int htype;
+ int success = 0;
if ((path = strchr(arg, ':')) != NULL)
*path++ = '\0';
@@ -391,7 +392,10 @@ unexportfs(char *arg, int verbose)
#endif
exp->m_xtabent = 0;
exp->m_mayexport = 0;
+ success = 1;
}
+ if (!success)
+ xlog(L_ERROR, "Could not find %s to unexport.\n", arg);
freeaddrinfo(ai);
}