diff options
| author | Brent Cook <busterb@gmail.com> | 2020-04-14 22:29:37 -0500 |
|---|---|---|
| committer | Brent Cook <busterb@gmail.com> | 2020-04-14 22:29:37 -0500 |
| commit | 79f2a52a391dab35132a2aa998757abea7f32533 (patch) | |
| tree | b2cb1583eff69772b30acff7a7b4b7248a2f965a | |
| parent | ceeb3bb4f423db4fc29704aa5a4c577f08103194 (diff) | |
| download | portable-79f2a52a391dab35132a2aa998757abea7f32533.tar.gz portable-79f2a52a391dab35132a2aa998757abea7f32533.tar.bz2 portable-79f2a52a391dab35132a2aa998757abea7f32533.zip | |
avoid exporting a sleep() symbol from libcrypto
Since it seems only MSVC lacks sleep(), and it's only used by apps, lets
special-case that and make it available as a static inline function
instead.
| -rw-r--r-- | crypto/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | crypto/compat/posix_win.c | 6 | ||||
| -rw-r--r-- | include/compat/unistd.h | 8 |
3 files changed, 7 insertions, 8 deletions
diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index e6cfc65..01effbf 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt | |||
| @@ -808,7 +808,6 @@ if(WIN32) | |||
| 808 | set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_write) | 808 | set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_write) |
| 809 | set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_getsockopt) | 809 | set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_getsockopt) |
| 810 | set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_setsockopt) | 810 | set(EXTRA_EXPORT ${EXTRA_EXPORT} posix_setsockopt) |
| 811 | set(EXTRA_EXPORT ${EXTRA_EXPORT} sleep) | ||
| 812 | endif() | 811 | endif() |
| 813 | 812 | ||
| 814 | if(NOT HAVE_ASPRINTF) | 813 | if(NOT HAVE_ASPRINTF) |
diff --git a/crypto/compat/posix_win.c b/crypto/compat/posix_win.c index 4b4b5f5..30c93cd 100644 --- a/crypto/compat/posix_win.c +++ b/crypto/compat/posix_win.c | |||
| @@ -242,10 +242,4 @@ int gettimeofday(struct timeval * tp, struct timezone * tzp) | |||
| 242 | return 0; | 242 | return 0; |
| 243 | } | 243 | } |
| 244 | 244 | ||
| 245 | unsigned int sleep(unsigned int seconds) | ||
| 246 | { | ||
| 247 | Sleep(seconds * 1000); | ||
| 248 | return seconds; | ||
| 249 | } | ||
| 250 | |||
| 251 | #endif | 245 | #endif |
diff --git a/include/compat/unistd.h b/include/compat/unistd.h index f521b94..4c4df10 100644 --- a/include/compat/unistd.h +++ b/include/compat/unistd.h | |||
| @@ -37,7 +37,13 @@ ssize_t pwrite(int d, const void *buf, size_t nbytes, off_t offset); | |||
| 37 | 37 | ||
| 38 | #define access _access | 38 | #define access _access |
| 39 | 39 | ||
| 40 | unsigned int sleep(unsigned int seconds); | 40 | #ifdef _MSC_VER |
| 41 | static inline unsigned int sleep(unsigned int seconds) | ||
| 42 | { | ||
| 43 | Sleep(seconds * 1000); | ||
| 44 | return seconds; | ||
| 45 | } | ||
| 46 | #endif | ||
| 41 | 47 | ||
| 42 | int ftruncate(int fd, off_t length); | 48 | int ftruncate(int fd, off_t length); |
| 43 | uid_t getuid(void); | 49 | uid_t getuid(void); |
