X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=src%2Fscript.c;h=2117aebe1cd4201cdfdf632eb881d143715d07b6;hb=e8b21f28d61621624a74c40f3709835476a88293;hp=2a34ea00191e62779d58a91aa5d7aa7cdd80b93b;hpb=0b77e6065dc833da19ddff6e04e4f09c805c6883;p=odhcp6c.git diff --git a/src/script.c b/src/script.c index 2a34ea0..2117aeb 100644 --- a/src/script.c +++ b/src/script.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -23,7 +24,7 @@ #include "odhcp6c.h" static const char hexdigits[] = "0123456789abcdef"; -static const char hexvals[] = { +static const int8_t hexvals[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, @@ -57,7 +58,8 @@ ssize_t script_unhexlify(uint8_t *dst, size_t len, const char *src) || y < 0 || (y = hexvals[y]) < 0) return -1; dst[c] = x << 4 | y; - while (*src < 0 || (*src && hexvals[(uint8_t)*src] < 0)) + while (((int8_t)*src) < 0 || + (*src && hexvals[(uint8_t)*src] < 0)) src++; } @@ -156,6 +158,7 @@ static void prefix_to_env(const char *name, const uint8_t *fqdn, size_t len) void script_call(const char *status) { + syslog(LOG_WARNING, "State for %s changed to %s", argv[1], status); size_t dns_len, search_len, custom_len; struct in6_addr *dns = odhcp6c_get_state(STATE_DNS, &dns_len); uint8_t *search = odhcp6c_get_state(STATE_SEARCH, &search_len);