3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/tools/networking/cjdns/makekeys-sigpipe.patch
2014-11-08 23:39:02 +01:00

30 lines
862 B
Diff

diff --git a/contrib/c/makekeys.c b/contrib/c/makekeys.c
index 29582f1..555cf85 100644
--- a/contrib/c/makekeys.c
+++ b/contrib/c/makekeys.c
@@ -21,6 +21,7 @@
#include "crypto_scalarmult_curve25519.h"
+#include <signal.h>
#include <stdio.h>
int main(int argc, char** argv)
@@ -35,6 +36,8 @@ int main(int argc, char** argv)
uint8_t hexPrivateKey[65];
uint8_t printedIp[40];
+ signal(SIGPIPE,SIG_DFL);
+
for (;;) {
Random_bytes(rand, privateKey, 32);
crypto_scalarmult_curve25519_base(publicKey, privateKey);
@@ -43,6 +46,7 @@ int main(int argc, char** argv)
Base32_encode(publicKeyBase32, 53, publicKey, 32);
AddrTools_printShortIp(printedIp, ip);
printf("%s %s %s.k\n", hexPrivateKey, printedIp, publicKeyBase32);
+ fflush(stdout);
}
}
return 0;