summary refs log tree commit diff
path: root/include/compat
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2026-06-01 14:38:30 -0400
committerJune McEnroe <june@causal.agency>2026-06-01 14:38:30 -0400
commitea9a686c1d3f4d7e8e80a907629149ce79b1964a (patch)
tree3bdfd8bbfc03aea5816109a1919fc39177f13885 /include/compat
parentImport LibreSSL 3.8.2 (diff)
downloadlibretls-ea9a686c1d3f4d7e8e80a907629149ce79b1964a.tar.gz
libretls-ea9a686c1d3f4d7e8e80a907629149ce79b1964a.zip
Import LibreSSL 3.8.3
Diffstat (limited to '')
-rw-r--r--[-rwxr-xr-x]include/compat/pthread.h13
-rw-r--r--include/compat/stdio.h2
2 files changed, 10 insertions, 5 deletions
diff --git a/include/compat/pthread.h b/include/compat/pthread.h
index 1ab011c..8211dda 100755..100644
--- a/include/compat/pthread.h
+++ b/include/compat/pthread.h
@@ -30,20 +30,25 @@ struct pthread_once {
 };
 typedef struct pthread_once pthread_once_t;
 
+struct _pthread_win32_cb_arg {
+	void (*cb)(void);
+};
+
 static inline BOOL CALLBACK
 _pthread_once_win32_cb(PINIT_ONCE once, PVOID param, PVOID *context)
 {
-	void (*cb) (void) = param;
-	cb();
+	struct _pthread_win32_cb_arg *arg = param;
+	arg->cb();
 	return TRUE;
 }
 
 static inline int
 pthread_once(pthread_once_t *once, void (*cb) (void))
 {
-	BOOL rc = InitOnceExecuteOnce(&once->once, _pthread_once_win32_cb, cb, NULL);
+	struct _pthread_win32_cb_arg arg = { .cb = cb };
+	BOOL rc = InitOnceExecuteOnce(&once->once, _pthread_once_win32_cb, &arg, NULL);
 	if (rc == 0)
-		return -1;
+		return EINVAL;
 	else
 		return 0;
 }
diff --git a/include/compat/stdio.h b/include/compat/stdio.h
index d5725c9..1874aa5 100644
--- a/include/compat/stdio.h
+++ b/include/compat/stdio.h
@@ -42,7 +42,7 @@ int posix_rename(const char *oldpath, const char *newpath);
 #define rename(oldpath, newpath) posix_rename(oldpath, newpath)
 #endif
 
-#ifdef _MSC_VER
+#if defined(_MSC_VER) && _MSC_VER < 1900
 #define snprintf _snprintf
 #endif