Don't set up an ongoing connection to myself.
[tinc] / src / sptps_keypair.c
index 63f396a..399404e 100644 (file)
 
 static char *program_name;
 
+void logger(int level, int priority, const char *format, ...) {
+       va_list ap;
+       va_start(ap, format);
+       vfprintf(stderr, format, ap);
+       va_end(ap);
+       fputc('\n', stderr);
+}
+
 static void usage() {
        fprintf(stderr, "Usage: %s [options] private_key_file public_key_file\n\n", program_name);
        fprintf(stderr, "Valid options are:\n"
@@ -83,7 +91,7 @@ int main(int argc, char *argv[]) {
                ecdsa_write_pem_private_key(key, fp);
                fclose(fp);
        } else {
-               fprintf(stderr, "Could not open '%s' for writing: %s\n", strerror(errno));
+               fprintf(stderr, "Could not open '%s' for writing: %s\n", argv[1], strerror(errno));
                return 1;
        }
 
@@ -92,7 +100,7 @@ int main(int argc, char *argv[]) {
                ecdsa_write_pem_public_key(key, fp);
                fclose(fp);
        } else {
-               fprintf(stderr, "Could not open '%s' for writing: %s\n", strerror(errno));
+               fprintf(stderr, "Could not open '%s' for writing: %s\n", argv[2], strerror(errno));
                return 1;
        }