summaryrefslogtreecommitdiffstats
path: root/support/export/hostname.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2013-10-22 04:36:54 -0400
committerSteve Dickson <steved@redhat.com>2013-10-22 04:36:54 -0400
commit232eb7ad09f9fd2ae4918699f850e4f8cadc2632 (patch)
tree75ee4dd5848ec657b794424e2000eed4f3daea9b /support/export/hostname.c
parentefe3c8d6cb4fc35909a64c0535087676a189fa5f (diff)
downloadnfs-utils-232eb7ad09f9fd2ae4918699f850e4f8cadc2632.tar.gz
nfs-utils-232eb7ad09f9fd2ae4918699f850e4f8cadc2632.tar.xz
nfs-utils-232eb7ad09f9fd2ae4918699f850e4f8cadc2632.zip
exportfs: exit with error code if there was any error.
exportfs currently exits with a non-zero error for some errors, but not for others. It does this by having various support routines set the global variable "export_errno". Change this to have 'xlog' set export_errno if an ERROR is reported. That way all errors will be caught. Note that the exit error code is changed from 22 (EINVAL) to the more traditional '1'. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'support/export/hostname.c')
-rw-r--r--support/export/hostname.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/support/export/hostname.c b/support/export/hostname.c
index 3e949a1..e53d692 100644
--- a/support/export/hostname.c
+++ b/support/export/hostname.c
@@ -175,10 +175,12 @@ host_addrinfo(const char *hostname)
case 0:
return ai;
case EAI_SYSTEM:
+ export_errno = errno;
xlog(D_GENERAL, "%s: failed to resolve %s: (%d) %m",
__func__, hostname, errno);
break;
default:
+ export_errno = EINVAL;
xlog(D_GENERAL, "%s: failed to resolve %s: %s",
__func__, hostname, gai_strerror(error));
break;