diff options
| author | Brent Cook <bcook@openbsd.org> | 2014-07-28 12:09:38 -0500 |
|---|---|---|
| committer | Brent Cook <bcook@openbsd.org> | 2014-07-28 13:52:07 -0500 |
| commit | 981fc3618a78970cca6327666366a7056edd3ebf (patch) | |
| tree | 4ab5ddc40a14bc81868cb4b736a3376108f3d85e /include | |
| parent | cd168d519bd2f44f03180f3c97bb476174ddb832 (diff) | |
| download | portable-981fc3618a78970cca6327666366a7056edd3ebf.tar.gz portable-981fc3618a78970cca6327666366a7056edd3ebf.tar.bz2 portable-981fc3618a78970cca6327666366a7056edd3ebf.zip | |
Guard individual compatibility header prototypes.
This is to avoid redefining prototypes from the libc headers. Also,
simplify the autoconf function checks and remove some copy/paste
errors checking for 'write'.
ok wouter@
Diffstat (limited to 'include')
| -rw-r--r-- | include/stdlib.h | 8 | ||||
| -rw-r--r-- | include/string.h | 15 | ||||
| -rw-r--r-- | include/unistd.h | 5 |
3 files changed, 27 insertions, 1 deletions
diff --git a/include/stdlib.h b/include/stdlib.h index 6c2de93..c314f38 100644 --- a/include/stdlib.h +++ b/include/stdlib.h | |||
| @@ -7,10 +7,18 @@ | |||
| 7 | #include <sys/time.h> | 7 | #include <sys/time.h> |
| 8 | #include <stdint.h> | 8 | #include <stdint.h> |
| 9 | 9 | ||
| 10 | #ifdef NO_ARC4RANDOM_BUF | ||
| 10 | uint32_t arc4random(void); | 11 | uint32_t arc4random(void); |
| 11 | void arc4random_buf(void *_buf, size_t n); | 12 | void arc4random_buf(void *_buf, size_t n); |
| 13 | #endif | ||
| 14 | |||
| 15 | #ifdef NO_REALLOCARRAY | ||
| 12 | void *reallocarray(void *, size_t, size_t); | 16 | void *reallocarray(void *, size_t, size_t); |
| 17 | #endif | ||
| 18 | |||
| 19 | #ifdef NO_STRTONUM | ||
| 13 | long long strtonum(const char *nptr, long long minval, | 20 | long long strtonum(const char *nptr, long long minval, |
| 14 | long long maxval, const char **errstr); | 21 | long long maxval, const char **errstr); |
| 22 | #endif | ||
| 15 | 23 | ||
| 16 | #endif | 24 | #endif |
diff --git a/include/string.h b/include/string.h index cd3430a..c4bf1e4 100644 --- a/include/string.h +++ b/include/string.h | |||
| @@ -12,21 +12,34 @@ | |||
| 12 | #include <strings.h> | 12 | #include <strings.h> |
| 13 | #endif | 13 | #endif |
| 14 | 14 | ||
| 15 | #ifdef NO_STRLCPY | ||
| 15 | size_t strlcpy(char *dst, const char *src, size_t siz); | 16 | size_t strlcpy(char *dst, const char *src, size_t siz); |
| 17 | #endif | ||
| 16 | 18 | ||
| 19 | #ifdef NO_STRLCAT | ||
| 17 | size_t strlcat(char *dst, const char *src, size_t siz); | 20 | size_t strlcat(char *dst, const char *src, size_t siz); |
| 21 | #endif | ||
| 18 | 22 | ||
| 23 | #ifdef NO_STRNDUP | ||
| 19 | char * strndup(const char *str, size_t maxlen); | 24 | char * strndup(const char *str, size_t maxlen); |
| 20 | |||
| 21 | size_t strnlen(const char *str, size_t maxlen); | 25 | size_t strnlen(const char *str, size_t maxlen); |
| 26 | #endif | ||
| 22 | 27 | ||
| 28 | #ifdef NO_EXPLICIT_BZERO | ||
| 23 | void explicit_bzero(void *, size_t); | 29 | void explicit_bzero(void *, size_t); |
| 30 | #endif | ||
| 24 | 31 | ||
| 32 | #ifdef NO_TIMINGSAFE_BCMP | ||
| 25 | int timingsafe_bcmp(const void *b1, const void *b2, size_t n); | 33 | int timingsafe_bcmp(const void *b1, const void *b2, size_t n); |
| 34 | #endif | ||
| 26 | 35 | ||
| 36 | #ifdef NO_TIMINGSAFE_MEMCMP | ||
| 27 | int timingsafe_memcmp(const void *b1, const void *b2, size_t len); | 37 | int timingsafe_memcmp(const void *b1, const void *b2, size_t len); |
| 38 | #endif | ||
| 28 | 39 | ||
| 40 | #ifdef NO_MEMMEM | ||
| 29 | void * memmem(const void *big, size_t big_len, const void *little, | 41 | void * memmem(const void *big, size_t big_len, const void *little, |
| 30 | size_t little_len); | 42 | size_t little_len); |
| 43 | #endif | ||
| 31 | 44 | ||
| 32 | #endif | 45 | #endif |
diff --git a/include/unistd.h b/include/unistd.h index ae82b95..037b11a 100644 --- a/include/unistd.h +++ b/include/unistd.h | |||
| @@ -3,7 +3,12 @@ | |||
| 3 | #ifndef LIBCRYPTOCOMPAT_UNISTD_H | 3 | #ifndef LIBCRYPTOCOMPAT_UNISTD_H |
| 4 | #define LIBCRYPTOCOMPAT_UNISTD_H | 4 | #define LIBCRYPTOCOMPAT_UNISTD_H |
| 5 | 5 | ||
| 6 | #ifdef NO_GETENTROPY | ||
| 6 | int getentropy(void *buf, size_t buflen); | 7 | int getentropy(void *buf, size_t buflen); |
| 8 | #endif | ||
| 9 | |||
| 10 | #ifdef NO_ISSETUGID | ||
| 7 | int issetugid(void); | 11 | int issetugid(void); |
| 12 | #endif | ||
| 8 | 13 | ||
| 9 | #endif | 14 | #endif |
