Skip to content

Commit dbdedcc

Browse files
committed
tlshd: Remove unneeded variable "error"
Clean up: Commit c380357 ("tlshd: Demote warnings about missing options") removed some debug messages that used the local "error" variable. "error" is passed to glib, but the returned value is no longer checked or used. Fixes: c380357 ("tlshd: Demote warnings about missing options") Signed-off-by: Chuck Lever <[email protected]>
1 parent 78e91a7 commit dbdedcc

File tree

1 file changed

+14
-30
lines changed

1 file changed

+14
-30
lines changed

src/tlshd/config.c

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,13 @@ static bool tlshd_config_read_datum(const char *pathname, gnutls_datum_t *data,
193193
*/
194194
bool tlshd_config_get_client_truststore(char **bundle)
195195
{
196-
GError *error = NULL;
197196
gchar *pathname;
198197

199198
pathname = g_key_file_get_string(tlshd_configuration, "authenticate.client",
200-
"x509.truststore", &error);
201-
if (!pathname) {
202-
g_error_free(error);
199+
"x509.truststore", NULL);
200+
if (!pathname)
203201
return false;
204-
} else if (access(pathname, F_OK)) {
202+
if (access(pathname, F_OK)) {
205203
tlshd_log_debug("tlshd cannot access \"%s\"", pathname);
206204
g_free(pathname);
207205
return false;
@@ -228,17 +226,14 @@ bool tlshd_config_get_client_truststore(char **bundle)
228226
bool tlshd_config_get_client_certs(gnutls_pcert_st *certs,
229227
unsigned int *certs_len)
230228
{
231-
GError *error = NULL;
232229
gnutls_datum_t data;
233230
gchar *pathname;
234231
int ret;
235232

236233
pathname = g_key_file_get_string(tlshd_configuration, "authenticate.client",
237-
"x509.certificate", &error);
238-
if (!pathname) {
239-
g_error_free(error);
234+
"x509.certificate", NULL);
235+
if (!pathname)
240236
return false;
241-
}
242237

243238
if (!tlshd_config_read_datum(pathname, &data, TLSHD_OWNER,
244239
TLSHD_CERT_MODE)) {
@@ -272,17 +267,14 @@ bool tlshd_config_get_client_certs(gnutls_pcert_st *certs,
272267
*/
273268
bool tlshd_config_get_client_privkey(gnutls_privkey_t *privkey)
274269
{
275-
GError *error = NULL;
276270
gnutls_datum_t data;
277271
gchar *pathname;
278272
int ret;
279273

280274
pathname = g_key_file_get_string(tlshd_configuration, "authenticate.client",
281-
"x509.private_key", &error);
282-
if (!pathname) {
283-
g_error_free(error);
275+
"x509.private_key", NULL);
276+
if (!pathname)
284277
return false;
285-
}
286278

287279
if (!tlshd_config_read_datum(pathname, &data, TLSHD_OWNER,
288280
TLSHD_PRIVKEY_MODE)) {
@@ -323,15 +315,13 @@ bool tlshd_config_get_client_privkey(gnutls_privkey_t *privkey)
323315
*/
324316
bool tlshd_config_get_server_truststore(char **bundle)
325317
{
326-
GError *error = NULL;
327318
gchar *pathname;
328319

329320
pathname = g_key_file_get_string(tlshd_configuration, "authenticate.server",
330-
"x509.truststore", &error);
331-
if (!pathname) {
332-
g_error_free(error);
321+
"x509.truststore", NULL);
322+
if (!pathname)
333323
return false;
334-
} else if (access(pathname, F_OK)) {
324+
if (access(pathname, F_OK)) {
335325
tlshd_log_debug("tlshd cannot access \"%s\"", pathname);
336326
g_free(pathname);
337327
return false;
@@ -358,17 +348,14 @@ bool tlshd_config_get_server_truststore(char **bundle)
358348
bool tlshd_config_get_server_certs(gnutls_pcert_st *certs,
359349
unsigned int *certs_len)
360350
{
361-
GError *error = NULL;
362351
gnutls_datum_t data;
363352
gchar *pathname;
364353
int ret;
365354

366355
pathname = g_key_file_get_string(tlshd_configuration, "authenticate.server",
367-
"x509.certificate", &error);
368-
if (!pathname) {
369-
g_error_free(error);
356+
"x509.certificate", NULL);
357+
if (!pathname)
370358
return false;
371-
}
372359

373360
if (!tlshd_config_read_datum(pathname, &data, TLSHD_OWNER,
374361
TLSHD_CERT_MODE)) {
@@ -402,17 +389,14 @@ bool tlshd_config_get_server_certs(gnutls_pcert_st *certs,
402389
*/
403390
bool tlshd_config_get_server_privkey(gnutls_privkey_t *privkey)
404391
{
405-
GError *error = NULL;
406392
gnutls_datum_t data;
407393
gchar *pathname;
408394
int ret;
409395

410396
pathname = g_key_file_get_string(tlshd_configuration, "authenticate.server",
411-
"x509.private_key", &error);
412-
if (!pathname) {
413-
g_error_free(error);
397+
"x509.private_key", NULL);
398+
if (!pathname)
414399
return false;
415-
}
416400

417401
if (!tlshd_config_read_datum(pathname, &data, TLSHD_OWNER,
418402
TLSHD_PRIVKEY_MODE)) {

0 commit comments

Comments
 (0)