diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-05-15 23:24:48 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-05-17 18:13:14 +0200 |
commit | 945fae0c7cfa787785833f0335e97c3fd30a79a8 (patch) | |
tree | 85fb0751296a712a706fa2b9b1183756c2610154 /src/config.c | |
parent | wg: check for proto error on set too (diff) | |
download | wireguard-tools-945fae0c7cfa787785833f0335e97c3fd30a79a8.tar.xz wireguard-tools-945fae0c7cfa787785833f0335e97c3fd30a79a8.zip |
wg: support text-based ipc
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/config.c b/src/config.c index 7007b88..f57fa82 100644 --- a/src/config.c +++ b/src/config.c @@ -15,7 +15,7 @@ #include "config.h" #include "ipc.h" -#include "base64.h" +#include "encoding.h" #define COMMENT_CHAR '#' @@ -171,14 +171,12 @@ static inline bool parse_endpoint(struct sockaddr *endpoint, const char *value) fprintf(stderr, "Unable to find matching brace of endpoint: `%s`\n", value); return false; } - *end = '\0'; - ++end; - if (*end != ':' || !*(end + 1)) { + *end++ = '\0'; + if (*end++ != ':' || !*end) { free(mutable); fprintf(stderr, "Unable to find port of endpoint: `%s`\n", value); return false; } - ++end; } else { begin = mutable; end = strrchr(mutable, ':'); @@ -187,8 +185,7 @@ static inline bool parse_endpoint(struct sockaddr *endpoint, const char *value) fprintf(stderr, "Unable to find port of endpoint: `%s`\n", value); return false; } - *end = '\0'; - ++end; + *end++ = '\0'; } for (unsigned int timeout = 1000000; timeout < 90000000; timeout = timeout * 3 / 2) { |