X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Finvitation.c;h=a94460e86ea23fa15ddbfdd10349028b21ced84d;hb=00398a60ec317740bcec83c5a524c5a95ce7f1c2;hp=6ccfc1f4cf8e7499bbf2e407174074d698c23aa3;hpb=933f7f7526d89a4ad41e2c2936c26cb41997ed78;p=tinc diff --git a/src/invitation.c b/src/invitation.c index 6ccfc1f4..a94460e8 100644 --- a/src/invitation.c +++ b/src/invitation.c @@ -404,8 +404,12 @@ int cmd_invite(int argc, char *argv[]) { char buf[1024]; while(fgets(buf, sizeof buf, tc)) { if((!strncasecmp(buf, "Mode", 4) && strchr(" \t=", buf[4])) - || (!strncasecmp(buf, "Broadcast", 9) && strchr(" \t=", buf[9]))) + || (!strncasecmp(buf, "Broadcast", 9) && strchr(" \t=", buf[9]))) { fputs(buf, f); + // Make sure there is a newline character. + if(!strchr(buf, '\n')) + fputc('\n', f); + } } fclose(tc); } @@ -823,7 +827,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; }