From 8a6cdf29ea6427cd8e96c00bc3d03abe1a67e8a3 Mon Sep 17 00:00:00 2001
From: lingsheng <lingsheng@huawei.com>
Date: Thu, 11 Mar 2021 16:03:35 +0800
Subject: [PATCH] Fix radeapclient option -q

---
 src/modules/rlm_eap/radeapclient.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/modules/rlm_eap/radeapclient.c b/src/modules/rlm_eap/radeapclient.c
index 553a6a6..d505ae8 100644
--- a/src/modules/rlm_eap/radeapclient.c
+++ b/src/modules/rlm_eap/radeapclient.c
@@ -1899,8 +1899,6 @@ int main(int argc, char **argv)
 		.debug_file = NULL,
 	};
 
-	radlog_init(&radclient_log, false);
-
 	/*
 	 *	We probably don't want to free the talloc autofree context
 	 *	directly, so we'll allocate a new context beneath it, and
@@ -1938,6 +1936,8 @@ int main(int argc, char **argv)
 			break;
 		case 'q':
 			do_output = 0;
+			radclient_log.dst = L_DST_NULL;
+			radclient_log.fd = 0;
 			break;
 		case 'x':
 			rad_debug_lvl++;
@@ -2013,6 +2013,8 @@ int main(int argc, char **argv)
 		usage();
 	}
 
+	radlog_init(&radclient_log, false);
+
 	/* Prepare the timeout. */
 	rc_float_to_timeval(&tv_timeout, timeout);
 
-- 
2.23.0

