-/* $OpenBSD: ssh-keyscan.c,v 1.151 2023/02/10 06:41:53 jmc Exp $ */
+/* $OpenBSD: ssh-keyscan.c,v 1.152 2023/03/31 04:21:56 djm Exp $ */
/*
* Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>.
*
{
char *hostport = NULL, *hashed = NULL;
const char *known_host;
+ int r = 0;
found_one = 1;
fatal("host_hash failed");
known_host = hash_hosts ? hashed : hostport;
if (!get_cert)
- fprintf(stdout, "%s ", known_host);
- sshkey_write(key, stdout);
- fputs("\n", stdout);
+ r = fprintf(stdout, "%s ", known_host);
+ if (r >= 0 && sshkey_write(key, stdout) == 0)
+ (void)fputs("\n", stdout);
free(hashed);
free(hostport);
}