From 4e7b2d6be3c7fbd9b2b3bd66c78111926e4fc127 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Mon, 22 Mar 2010 16:25:20 +0100 Subject: [PATCH 08/12] Replace CA/CRL stat logic with g_file_test to improve portability --- wocky/wocky-openssl.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/wocky/wocky-openssl.c b/wocky/wocky-openssl.c index 4425b68..2f36d1f 100644 --- a/wocky/wocky-openssl.c +++ b/wocky/wocky-openssl.c @@ -727,21 +727,20 @@ add_ca_or_crl (WockyTLSSession *session, const gchar *label) { gboolean ok = FALSE; - struct stat target; - if (stat (path, &target) != 0) + if (!g_file_test (path, G_FILE_TEST_EXISTS)) { DEBUG ("%s file or path '%s' not accessible", label, path); return; } - if (S_ISDIR (target.st_mode)) + if (g_file_test (path, G_FILE_TEST_IS_DIR)) { DEBUG ("Loading %s directory", label); ok = SSL_CTX_load_verify_locations (session->ctx, NULL, path); } - if (S_ISREG (target.st_mode)) + if (g_file_test (path, G_FILE_TEST_IS_REGULAR)) { DEBUG ("Loading %s file", label); ok = SSL_CTX_load_verify_locations (session->ctx, path, NULL); -- 1.6.4.msysgit.0