summary refs log tree commit diff
path: root/setup.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--setup.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/setup.c b/setup.c
index 633a1f4..92509e3 100644
--- a/setup.c
+++ b/setup.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2018, Curtis McEnroe <programble@gmail.com>
+/* Copyright (C) 2018  Causal Agent June <june@causal.agency>
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
@@ -23,18 +23,18 @@
 #include <unistd.h>
 
 int main(int argc, char *argv[]) {
-    if (argc < 2) return EX_USAGE;
+    if (argc < 2) errx(EX_USAGE, "missing public id");
 
-    uint32_t key[4];
+    uint32_t id[4];
     char public[7 + 32 + 1];
     char private[8 + 32 + 1];
 
+    arc4random_buf(id, sizeof(id));
     snprintf(public, sizeof(public), "public/%s", argv[1]);
-    arc4random_buf(key, sizeof(key));
     snprintf(
         private, sizeof(private),
         "private/%08x%08x%08x%08x",
-        key[0], key[1], key[2], key[3]
+        id[0], id[1], id[2], id[3]
     );
 
     int fd = open(public, O_CREAT | O_EXCL, 0644);
@@ -44,6 +44,6 @@ int main(int argc, char *argv[]) {
     int error = symlink(public, private);
     if (error) err(EX_CANTCREAT, "%s", private);
 
-    printf("%08x%08x%08x%08x\n", key[0], key[1], key[2], key[3]);
+    printf("%08x%08x%08x%08x\n", id[0], id[1], id[2], id[3]);
     return EX_OK;
 }