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 <bbe@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
fips-20240407
David Benjamin 9 months ago committed by Boringssl LUCI CQ
parent 6db6604cb5
commit d4faa8d63a
  1. 14
      crypto/x509/by_dir.c

@ -56,8 +56,6 @@
#include <inttypes.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <openssl/buf.h>
#include <openssl/err.h>
@ -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;

Loading…
Cancel
Save