Skip to content

Commit

Permalink
fix preprocessor logic with HAVE_STAT
Browse files Browse the repository at this point in the history
The _WIN32 check is inside a preprocessor branch that has already
checked that _WIN32 is not defined.

On the other hand, if HAVE_STAT is not available, then the function
does not have an alternative method to check that a file exists. The
not-apple-not-windows branch should have stat() available, so this is
a very unlikely situation.
  • Loading branch information
createyourpersonalaccount committed Jan 4, 2025
1 parent faa9721 commit 2f10ccd
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/lib/crypto/ares_openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,8 @@ static ares_bool_t file_exists(const char *path, ares_bool_t is_directory)
if (stat(filename, &st) != 0) {
return ARES_FALSE;
}
# elif defined(_WIN32)
struct _stat st;
if (_stat(filename, &st) != 0) {
return ARES_FALSE;
}
# else
# error "Need stat() function for crypto subsystem with OpenSSL."
# endif
if (is_directory) {
if (st.st_mode & S_IFDIR) {
Expand Down

0 comments on commit 2f10ccd

Please sign in to comment.