aboutsummaryrefslogtreecommitdiff
path: root/external/unbound/compat
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2014-12-04 23:10:49 +0200
committerRiccardo Spagni <ric@spagni.net>2014-12-04 23:10:49 +0200
commit831933425b3406310e70476dc56e822f7ae3c549 (patch)
treebd05c1b54f8cff8ef0bc1f769a22232172ec2a96 /external/unbound/compat
parentincreased version number for tagged release (diff)
downloadmonero-831933425b3406310e70476dc56e822f7ae3c549.tar.xz
update unbound from upstream
Diffstat (limited to '')
-rw-r--r--external/unbound/compat/arc4_lock.c4
-rw-r--r--external/unbound/compat/getentropy_linux.c11
-rw-r--r--external/unbound/compat/getentropy_win.c4
-rw-r--r--external/unbound/compat/inet_aton.c10
-rw-r--r--external/unbound/compat/memmove.c2
-rw-r--r--external/unbound/compat/strptime.c8
6 files changed, 21 insertions, 18 deletions
diff --git a/external/unbound/compat/arc4_lock.c b/external/unbound/compat/arc4_lock.c
index ce8bb4168..faa743d15 100644
--- a/external/unbound/compat/arc4_lock.c
+++ b/external/unbound/compat/arc4_lock.c
@@ -53,8 +53,10 @@ static int arc4lockinit = 0;
void _ARC4_LOCK(void)
{
- if(!arc4lockinit)
+ if(!arc4lockinit) {
+ arc4lockinit = 1;
lock_quick_init(&arc4lock);
+ }
lock_quick_lock(&arc4lock);
}
diff --git a/external/unbound/compat/getentropy_linux.c b/external/unbound/compat/getentropy_linux.c
index d51d7952d..32d58a7cd 100644
--- a/external/unbound/compat/getentropy_linux.c
+++ b/external/unbound/compat/getentropy_linux.c
@@ -48,6 +48,7 @@
#include <time.h>
#include <openssl/sha.h>
+#include <linux/types.h>
#include <linux/random.h>
#include <linux/sysctl.h>
#ifdef HAVE_GETAUXVAL
@@ -77,7 +78,7 @@ extern int main(int, char *argv[]);
#endif
static int gotdata(char *buf, size_t len);
static int getentropy_urandom(void *buf, size_t len);
-#ifdef CTL_MAXNAME
+#ifdef SYS__sysctl
static int getentropy_sysctl(void *buf, size_t len);
#endif
static int getentropy_fallback(void *buf, size_t len);
@@ -102,7 +103,7 @@ getentropy(void *buf, size_t len)
if (ret != -1)
return (ret);
-#ifdef CTL_MAXNAME
+#ifdef SYS__sysctl
/*
* Try to use sysctl CTL_KERN, KERN_RANDOM, RANDOM_UUID.
* sysctl is a failsafe API, so it guarantees a result. This
@@ -124,7 +125,7 @@ getentropy(void *buf, size_t len)
ret = getentropy_sysctl(buf, len);
if (ret != -1)
return (ret);
-#endif /* CTL_MAXNAME */
+#endif /* SYS__sysctl */
/*
* Entropy collection via /dev/urandom and sysctl have failed.
@@ -235,7 +236,7 @@ nodevrandom:
return -1;
}
-#ifdef CTL_MAXNAME
+#ifdef SYS__sysctl
static int
getentropy_sysctl(void *buf, size_t len)
{
@@ -265,7 +266,7 @@ sysctlfailed:
errno = EIO;
return -1;
}
-#endif /* CTL_MAXNAME */
+#endif /* SYS__sysctl */
static int cl[] = {
CLOCK_REALTIME,
diff --git a/external/unbound/compat/getentropy_win.c b/external/unbound/compat/getentropy_win.c
index 9dc55891e..71fb955e7 100644
--- a/external/unbound/compat/getentropy_win.c
+++ b/external/unbound/compat/getentropy_win.c
@@ -41,9 +41,9 @@ getentropy(void *buf, size_t len)
}
if (CryptAcquireContext(&provider, NULL, NULL, PROV_RSA_FULL,
- CRYPT_VERIFYCONTEXT) != 0)
+ CRYPT_VERIFYCONTEXT) == 0)
goto fail;
- if (CryptGenRandom(provider, len, buf) != 0) {
+ if (CryptGenRandom(provider, len, buf) == 0) {
CryptReleaseContext(provider, 0);
goto fail;
}
diff --git a/external/unbound/compat/inet_aton.c b/external/unbound/compat/inet_aton.c
index 33c323d99..e93fe8d73 100644
--- a/external/unbound/compat/inet_aton.c
+++ b/external/unbound/compat/inet_aton.c
@@ -103,7 +103,7 @@ inet_aton(const char *cp, struct in_addr *addr)
* Values are specified as for C:
* 0x=hex, 0=octal, isdigit=decimal.
*/
- if (!isdigit(c))
+ if (!isdigit((unsigned char)c))
return (0);
val = 0; base = 10;
if (c == '0') {
@@ -114,12 +114,12 @@ inet_aton(const char *cp, struct in_addr *addr)
base = 8;
}
for (;;) {
- if (isascii(c) && isdigit(c)) {
+ if (isascii((unsigned char)c) && isdigit((unsigned char)c)) {
val = (val * base) + (c - '0');
c = *++cp;
- } else if (base == 16 && isascii(c) && isxdigit(c)) {
+ } else if (base == 16 && isascii((unsigned char)c) && isxdigit((unsigned char)c)) {
val = (val << 4) |
- (c + 10 - (islower(c) ? 'a' : 'A'));
+ (c + 10 - (islower((unsigned char)c) ? 'a' : 'A'));
c = *++cp;
} else
break;
@@ -141,7 +141,7 @@ inet_aton(const char *cp, struct in_addr *addr)
/*
* Check for trailing characters.
*/
- if (c != '\0' && (!isascii(c) || !isspace(c)))
+ if (c != '\0' && (!isascii((unsigned char)c) || !isspace((unsigned char)c)))
return (0);
/*
* Concoct the address according to
diff --git a/external/unbound/compat/memmove.c b/external/unbound/compat/memmove.c
index 0035bbf75..fe319bb49 100644
--- a/external/unbound/compat/memmove.c
+++ b/external/unbound/compat/memmove.c
@@ -28,7 +28,7 @@ void *memmove(void *dest, const void *src, size_t n)
to[i] = from[i];
return dest;
}
- if (from > to && from-to < (int)n) {
+ if (from > to && from-to < (int)n) {
/* to overlaps with from */
/* <from......> */
/* <to........> */
diff --git a/external/unbound/compat/strptime.c b/external/unbound/compat/strptime.c
index 9a0caa535..10ec31574 100644
--- a/external/unbound/compat/strptime.c
+++ b/external/unbound/compat/strptime.c
@@ -89,7 +89,7 @@ str2int(const char **buf, int max)
{
int ret=0, count=0;
- while (*buf[0] != '\0' && isdigit(*buf[0]) && count<max) {
+ while (*buf[0] != '\0' && isdigit((unsigned char)*buf[0]) && count<max) {
ret = ret*10 + (*buf[0] - '0');
(*buf)++;
count++;
@@ -111,11 +111,11 @@ unbound_strptime(const char *s, const char *format, struct tm *tm)
while ((c = *format) != '\0') {
/* whitespace, literal or format */
- if (isspace(c)) { /* whitespace */
+ if (isspace((unsigned char)c)) { /* whitespace */
/** whitespace matches zero or more whitespace characters in the
* input string.
**/
- while (isspace(*s))
+ while (isspace((unsigned char)*s))
s++;
}
else if (c == '%') { /* format */
@@ -221,7 +221,7 @@ unbound_strptime(const char *s, const char *format, struct tm *tm)
break;
case 'n': /* arbitrary whitespace */
case 't':
- while (isspace(*s))
+ while (isspace((unsigned char)*s))
s++;
break;
case 'p': /* am pm */