Don't try to mkdir(CONFDIR) if --config is used.
[tinc] / src / invitation.c
index 3f7f976..59bcf45 100644 (file)
@@ -340,12 +340,17 @@ int cmd_invite(int argc, char *argv[]) {
                }
                chmod(filename, 0600);
                ecdsa_write_pem_private_key(key, f);
+               fclose(f);
+
+               if(connect_tincd(false))
+                       sendline(fd, "%d %d", CONTROL, REQ_RELOAD);
        } else {
                key = ecdsa_read_pem_private_key(f);
+               fclose(f);
                if(!key)
                        fprintf(stderr, "Could not read private key from %s\n", filename);
        }
-       fclose(f);
+
        free(filename);
        if(!key)
                return 1;
@@ -818,7 +823,7 @@ int cmd_join(int argc, char *argv[]) {
        }
 
        // Make sure confbase exists and is accessible.
-       if(strcmp(confdir, confbase) && mkdir(confdir, 0755) && errno != EEXIST) {
+       if(!confbase_given && mkdir(confdir, 0755) && errno != EEXIST) {
                fprintf(stderr, "Could not create directory %s: %s\n", confdir, strerror(errno));
                return 1;
        }