X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ftincctl.c;h=45bf6ee566a3f789c3356b972909c14432978abd;hb=1bb969c9306812d0d5c954fe8db32ed1a248bf20;hp=afaeda3250f680d9b8293bce2a96639b16393389;hpb=94587264bda45cce0295aaa37b59905d4b9843a8;p=tinc diff --git a/src/tincctl.c b/src/tincctl.c index afaeda32..45bf6ee5 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -1,6 +1,6 @@ /* tincctl.c -- Controlling a running tincd - Copyright (C) 2007-2012 Guus Sliepen + Copyright (C) 2007-2013 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -834,16 +834,10 @@ static int cmd_stop(int argc, char *argv[]) { } sendline(fd, "%d %d", CONTROL, REQ_STOP); - if(!recvline(fd, line, sizeof line) || sscanf(line, "%d %d %d", &code, &req, &result) != 3 || code != CONTROL || req != REQ_STOP || result) { - fprintf(stderr, "Could not stop tinc daemon.\n"); - return 1; - } - // Wait for tincd to close the connection... - fd_set r; - FD_ZERO(&r); - FD_SET(fd, &r); - select(fd + 1, &r, NULL, NULL, NULL); + while(recvline(fd, line, sizeof line)) { + // Wait for tincd to close the connection... + } #else if(!remove_service()) return 1; @@ -1844,6 +1838,8 @@ static int cmd_export(int argc, char *argv[]) { int result = export(name, stdout); if(!tty) fclose(stdout); + + free(name); return result; }