From: Guus Sliepen Date: Sun, 15 Jul 2012 18:59:17 +0000 (+0200) Subject: Have tincctl notify a running tincd of configuration file changes. X-Git-Tag: import-tinc-1.1~361 X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=439069bda62b25baaabeb765ac0557efa57b6cfb;p=meshlink Have tincctl notify a running tincd of configuration file changes. --- diff --git a/src/tincctl.c b/src/tincctl.c index 6725b8b2..b2a6561f 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -1163,6 +1163,12 @@ static int cmd_config(int argc, char *argv[]) { return 1; } + // Silently try notifying a running tincd of changes. + fclose(stderr); + + if(connect_tincd()) + sendline(fd, "%d %d", CONTROL, REQ_RELOAD); + return 0; } @@ -1319,7 +1325,17 @@ static int cmd_edit(int argc, char *argv[]) { char *command; xasprintf(&command, "\"%s\" \"%s\"", editor, filename); - return system(command); + int result = system(command); + if(result) + return result; + + // Silently try notifying a running tincd of changes. + fclose(stderr); + + if(connect_tincd()) + sendline(fd, "%d %d", CONTROL, REQ_RELOAD); + + return 0; } static const struct {