Fix tincctl start.
[tinc] / src / tincctl.c
index 6725b8b..c165418 100644 (file)
@@ -655,6 +655,9 @@ static bool connect_tincd() {
 static int cmd_start(int argc, char *argv[]) {
        int i, j;
        char *c;
+
+       argc += optind;
+       argv -= optind;
        char *slash = strrchr(argv[0], '/');
 
 #ifdef HAVE_MINGW
@@ -1163,6 +1166,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 +1328,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 {