From 0dae2c75f774519507c90bd4c3e4a860e1c84ab8 Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Fri, 9 Oct 2015 16:29:21 -0400 Subject: Log useful message on kernel interface failure Also, cause all failures on accessing this interface to exit GSS-Proxy similar to config file errors. Ticket: https://fedorahosted.org/gss-proxy/ticket/126 Signed-off-by: Robbie Harwood Reviewed-by: Simo Sorce --- proxy/src/gp_init.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'proxy/src') diff --git a/proxy/src/gp_init.c b/proxy/src/gp_init.c index 3430c90..bb7ba6b 100644 --- a/proxy/src/gp_init.c +++ b/proxy/src/gp_init.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2011 the GSS-PROXY contributors, see COPYING for license */ +/* Copyright (C) 2011,2015 the GSS-PROXY contributors, see COPYING for license */ #include #include @@ -161,26 +161,29 @@ void init_proc_nfsd(struct gp_config *cfg) fd = open(LINUX_PROC_USE_GSS_PROXY_FILE, O_RDWR); if (fd == -1) { ret = errno; - GPDEBUG("Failed to open %s: %d (%s)\n", + fprintf(stderr, "GSS-Proxy is not supported by this kernel since " + "file %s could not be found: %d (%s)\n", LINUX_PROC_USE_GSS_PROXY_FILE, ret, gp_strerror(ret)); - return; + exit(1); } ret = write(fd, buf, 1); if (ret != 1) { ret = errno; - GPDEBUG("Failed to write to %s: %d (%s)\n", + fprintf(stderr, "Failed to write to %s: %d (%s)\n", LINUX_PROC_USE_GSS_PROXY_FILE, ret, gp_strerror(ret)); + exit(1); } ret = close(fd); if (ret == -1) { ret = errno; - GPDEBUG("Failed to close %s: %d (%s)\n", + fprintf(stderr, "Failed to close %s: %d (%s)\n", LINUX_PROC_USE_GSS_PROXY_FILE, ret, gp_strerror(ret)); + exit(1); } } -- cgit