From d4faa8d63a06a5feff2e5b68695adf9bf8fd1f81 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Sun, 4 Feb 2024 09:26:55 -0500 Subject: [PATCH] Remove unnecessary stat calls from by_dir.c If the file doesn't exist, we'll fail when we go to read it anyway. The stat call just adds a needless ifdef here. Change-Id: I00a52f988bc1d45622e559b496ef2293b3719863 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/66011 Reviewed-by: Bob Beck Commit-Queue: David Benjamin --- crypto/x509/by_dir.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c index d675f29bb..5eca97bc7 100644 --- a/crypto/x509/by_dir.c +++ b/crypto/x509/by_dir.c @@ -56,8 +56,6 @@ #include #include -#include -#include #include #include @@ -318,18 +316,6 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, for (;;) { snprintf(b->data, b->max, "%s/%08" PRIx32 ".%s%d", ent->dir, h, postfix, k); -#ifndef OPENSSL_NO_POSIX_IO -#if defined(_WIN32) && !defined(stat) -#define stat _stat -#endif - { - struct stat st; - if (stat(b->data, &st) < 0) { - break; - } - } -#endif - // found one. if (type == X509_LU_X509) { if ((X509_load_cert_file(xl, b->data, ent->dir_type)) == 0) { break;