From d4a408776d611cd62235232d65d488d02fca78e4 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 5 Nov 2013 14:03:53 -0500 Subject: exportfs: exit with error code if there was any error (take 2). 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 Signed-off-by: Steve Dickson --- support/nfs/xlog.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'support/nfs/xlog.c') diff --git a/support/nfs/xlog.c b/support/nfs/xlog.c index 6820346..83d07e1 100644 --- a/support/nfs/xlog.c +++ b/support/nfs/xlog.c @@ -38,6 +38,8 @@ static int logmask = 0; /* What will be logged */ static char log_name[256]; /* name of this program */ static int log_pid = -1; /* PID of this program */ +int export_errno = 0; + static void xlog_toggle(int sig); static struct xlog_debugfac debugnames[] = { { "general", D_GENERAL, }, @@ -190,6 +192,9 @@ xlog(int kind, const char* fmt, ...) { va_list args; + if (kind & (L_ERROR|D_GENERAL)) + export_errno = 1; + va_start(args, fmt); xlog_backend(kind, fmt, args); va_end(args); -- cgit