Fix building with --disable-legacy-protocol.
[tinc] / src / tincctl.c
index 93c5b32..8181dd9 100644 (file)
@@ -2301,6 +2301,7 @@ static int cmd_init(int argc, char *argv[]) {
 
 static int cmd_generate_keys(int argc, char *argv[]) {
 #ifdef DISABLE_LEGACY
+       (void)argv;
 
        if(argc > 1) {
 #else
@@ -2440,10 +2441,14 @@ static int cmd_edit(int argc, char *argv[]) {
        char *command;
 #ifndef HAVE_MINGW
        const char *editor = getenv("VISUAL");
-       if (!editor)
+
+       if(!editor) {
                editor = getenv("EDITOR");
-       if (!editor)
+       }
+
+       if(!editor) {
                editor = "vi";
+       }
 
        xasprintf(&command, "\"%s\" \"%s\"", editor, filename);
 #else
@@ -2735,11 +2740,11 @@ static int cmd_fsck(int argc, char *argv[]) {
 
 static void *readfile(FILE *in, size_t *len) {
        size_t count = 0;
-       size_t alloced = 4096;
-       char *buf = xmalloc(alloced);
+       size_t bufsize = 4096;
+       char *buf = xmalloc(bufsize);
 
        while(!feof(in)) {
-               size_t read = fread(buf + count, 1, alloced - count, in);
+               size_t read = fread(buf + count, 1, bufsize - count, in);
 
                if(!read) {
                        break;
@@ -2747,9 +2752,9 @@ static void *readfile(FILE *in, size_t *len) {
 
                count += read;
 
-               if(count >= alloced) {
-                       alloced *= 2;
-                       buf = xrealloc(buf, alloced);
+               if(count >= bufsize) {
+                       bufsize *= 2;
+                       buf = xrealloc(buf, bufsize);
                }
        }