diff options
author | Linus Nordberg <linus@nordberg.se> | 2019-04-24 16:11:39 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordberg.se> | 2019-04-24 16:11:39 +0200 |
commit | ae16838248abb5406a8f48207082bc249e85ac37 (patch) | |
tree | 4c2ff4f8e3b64970b0d358c26ccf1d849d5c794f /wg-dynamic-client.c | |
parent | Do advance buffer after (second) short write (diff) | |
download | wg-dynamic-ae16838248abb5406a8f48207082bc249e85ac37.tar.xz wg-dynamic-ae16838248abb5406a8f48207082bc249e85ac37.zip |
Don't declare variables mid block
Also, do name variables slightly better.
Diffstat (limited to 'wg-dynamic-client.c')
-rw-r--r-- | wg-dynamic-client.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/wg-dynamic-client.c b/wg-dynamic-client.c index 8a1fecb..5bcd3b4 100644 --- a/wg-dynamic-client.c +++ b/wg-dynamic-client.c @@ -490,6 +490,7 @@ int main(int argc __attribute__((unused)), char *argv[] __attribute__((unused))) pollfds[0] = (struct pollfd){.fd = -1, .events = POLLIN }; while (1) { + size_t off; int nevents = poll(pollfds, 1, LEASE_CHECK_INTERVAL); if (nevents == -1) @@ -507,10 +508,9 @@ int main(int argc __attribute__((unused)), char *argv[] __attribute__((unused))) pollfds[0].revents &= ~POLLOUT; debug("sending, trying again with %lu bytes\n", req.buflen); - size_t w = send_message(pollfds[0].fd, req.buf, - &req.buflen); + off = send_message(pollfds[0].fd, req.buf, &req.buflen); if (req.buflen) - memmove(req.buf, req.buf + w, req.buflen); + memmove(req.buf, req.buf + off, req.buflen); else close_connection(&pollfds[0].fd, &req); } |