diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2024-10-18 05:37:25 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2024-10-18 05:37:25 +0000 |
commit | 85d8ac155a8f9cc127d9113b7f3fe53b2c3fb50f (patch) | |
tree | eddcc239e5aa77e4ea3d1d6dc89083ffbe461a04 /usr.bin | |
parent | 16b3f0d8e7f6017a37d88205466b6fce5164862b (diff) |
allow "-" as output file for moduli screening
based on GHPR393
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/ssh-keygen.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/ssh/ssh-keygen.c b/usr.bin/ssh/ssh-keygen.c index e384ccca6c8..8806c15779b 100644 --- a/usr.bin/ssh/ssh-keygen.c +++ b/usr.bin/ssh/ssh-keygen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-keygen.c,v 1.475 2024/09/15 00:47:01 djm Exp $ */ +/* $OpenBSD: ssh-keygen.c,v 1.476 2024/10/18 05:37:24 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -3005,7 +3005,9 @@ do_moduli_gen(const char *out_file, char **opts, size_t nopts) } } - if ((out = fopen(out_file, "w")) == NULL) { + if (strcmp(out_file, "-") == 0) + out = stdout; + else if ((out = fopen(out_file, "w")) == NULL) { fatal("Couldn't open modulus candidate file \"%s\": %s", out_file, strerror(errno)); } @@ -3070,7 +3072,9 @@ do_moduli_screen(const char *out_file, char **opts, size_t nopts) } } - if ((out = fopen(out_file, "a")) == NULL) { + if (strcmp(out_file, "-") == 0) + out = stdout; + else if ((out = fopen(out_file, "a")) == NULL) { fatal("Couldn't open moduli file \"%s\": %s", out_file, strerror(errno)); } |