Skip to content

Commit

Permalink
Only include winsock2.h for struct timeval if needed
Browse files Browse the repository at this point in the history
Fixes #22811

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from #22813)

(cherry picked from commit ba58e9f)
  • Loading branch information
hlandau committed Nov 27, 2023
1 parent e64ad80 commit b0e9d03
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion include/openssl/e_ostime.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@
*/

# if defined(OPENSSL_SYS_WINDOWS)
# include <winsock2.h>
# if !defined(_WINSOCKAPI_)
/*
* winsock2.h defines _WINSOCK2API_ and both winsock2.h and winsock.h define
* _WINSOCKAPI_. Both of these provide struct timeval. Don't include
* winsock2.h if either header has been included to avoid breakage with
* applications that prefer to use <winsock.h> over <winsock2.h>.
*/
# include <winsock2.h>
# endif
# else
# include <sys/time.h>
# endif
Expand Down

0 comments on commit b0e9d03

Please sign in to comment.