Windows fixes.

This commit is contained in:
Scott Duensing 2023-11-26 21:18:16 -06:00
parent 4d325c447e
commit ddb280ad26
2 changed files with 10 additions and 5 deletions

View file

@ -890,7 +890,11 @@ void unpackGames(void) {
isFile = false; isFile = false;
if ((strcmp(de->d_name, ".") != 0) && (strcmp(de->d_name, "..") != 0)) { if ((strcmp(de->d_name, ".") != 0) && (strcmp(de->d_name, "..") != 0)) {
if (stat(de->d_name, &fileStat) == 0) { if (stat(de->d_name, &fileStat) == 0) {
#ifdef _WIN32
if (S_ISREG(fileStat.st_mode)) {
#else
if (S_ISREG(fileStat.st_mode) || S_ISLNK(fileStat.st_mode)) { if (S_ISREG(fileStat.st_mode) || S_ISLNK(fileStat.st_mode)) {
#endif
isFile = true; isFile = true;
} }
} }

View file

@ -9,6 +9,7 @@
#include <string.h> #include <string.h>
#if defined(WIN32) #if defined(WIN32)
#include <winsock2.h>
#include <windows.h> #include <windows.h>
#endif #endif
@ -120,7 +121,7 @@ static const SSL_METHOD* str2method(const char *method, int *vmin, int *vmax)
*/ */
static int set_verify_flag(const char *str, int *flag) static int set_verify_flag(const char *str, int *flag)
{ {
if (!strcmp(str, "none")) { if (!strcmp(str, "none")) {
*flag |= SSL_VERIFY_NONE; *flag |= SSL_VERIFY_NONE;
return 1; return 1;
} }
@ -132,7 +133,7 @@ static int set_verify_flag(const char *str, int *flag)
*flag |= SSL_VERIFY_CLIENT_ONCE; *flag |= SSL_VERIFY_CLIENT_ONCE;
return 1; return 1;
} }
if (!strcmp(str, "fail_if_no_peer_cert")) { if (!strcmp(str, "fail_if_no_peer_cert")) {
*flag |= SSL_VERIFY_FAIL_IF_NO_PEER_CERT; *flag |= SSL_VERIFY_FAIL_IF_NO_PEER_CERT;
return 1; return 1;
} }
@ -399,7 +400,7 @@ static int load_key(lua_State *L)
SSL_CTX_set_default_passwd_cb(ctx, passwd_cb); SSL_CTX_set_default_passwd_cb(ctx, passwd_cb);
SSL_CTX_set_default_passwd_cb_userdata(ctx, L); SSL_CTX_set_default_passwd_cb_userdata(ctx, L);
/* fallback */ /* fallback */
case LUA_TNIL: case LUA_TNIL:
if (SSL_CTX_use_PrivateKey_file(ctx, filename, SSL_FILETYPE_PEM) == 1) if (SSL_CTX_use_PrivateKey_file(ctx, filename, SSL_FILETYPE_PEM) == 1)
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else { else {
@ -543,7 +544,7 @@ static int set_mode(lua_State *L)
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
lua_pushfstring(L, "invalid mode (%s)", str); lua_pushfstring(L, "invalid mode (%s)", str);
return 1; return 1;
} }
/** /**
* Configure DH parameters. * Configure DH parameters.
@ -677,7 +678,7 @@ static int alpn_cb(SSL *s, const unsigned char **out, unsigned char *outlen,
if (ret != OPENSSL_NPN_NEGOTIATED) { if (ret != OPENSSL_NPN_NEGOTIATED) {
lua_pop(L, 2); lua_pop(L, 2);
return SSL_TLSEXT_ERR_NOACK; return SSL_TLSEXT_ERR_NOACK;
} }
// Copy the result because lua_pop() can collect the pointer // Copy the result because lua_pop() can collect the pointer
ctx->alpn = malloc(*outlen); ctx->alpn = malloc(*outlen);