From 36ba7ddb7b1f78a74d395585704c9403af9682c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Gallou=C3=ABt?= Date: Wed, 17 Jan 2018 16:16:59 +0000 Subject: [PATCH] Cleanup mainctl.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Adrien Gallouët --- src/mainctl.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mainctl.c b/src/mainctl.c index 0f7fd1a..cd0e12c 100644 --- a/src/mainctl.c +++ b/src/mainctl.c @@ -14,7 +14,9 @@ static struct { char *dev; int version; -} gt = {}; +} gt = { + .dev = "tun0", +}; static int gt_setup_option(int argc, char **argv) @@ -24,7 +26,7 @@ gt_setup_option(int argc, char **argv) struct option opts[] = { { "dev", >.dev, option_str }, { "version", NULL, option_option }, - { NULL }, + { NULL }, }; // clang-format on @@ -56,7 +58,7 @@ main(int argc, char **argv) } if (ctl_connect(ctl_fd, "/run/" PACKAGE_NAME, gt.dev) == -1) { - perror("ctl_connect"); + gt_log("couldn't connect to %s\n", gt.dev); return 1; } @@ -81,10 +83,10 @@ main(int argc, char **argv) gt_print("PONG!\n"); break; case CTL_UNKNOWN: - gt_print("Unknown command: %i\n", reply.unknown.type); + gt_print("unknown command: %i\n", reply.unknown.type); break; default: - gt_print("Bad reply from server: %i\n", reply.type); + gt_log("bad reply from server: %i\n", reply.type); } close(ctl_fd);