=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/sshconnect.c,v retrieving revision 1.360 retrieving revision 1.361 diff -u -r1.360 -r1.361 --- src/usr.bin/ssh/sshconnect.c 2022/11/03 21:59:20 1.360 +++ src/usr.bin/ssh/sshconnect.c 2023/01/13 02:44:02 1.361 @@ -1,4 +1,4 @@ -/* $OpenBSD: sshconnect.c,v 1.360 2022/11/03 21:59:20 djm Exp $ */ +/* $OpenBSD: sshconnect.c,v 1.361 2023/01/13 02:44:02 djm Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -1238,8 +1238,11 @@ } /* The host key has changed. */ warn_changed_key(host_key); - error("Add correct host key in %.100s to get rid of this message.", - user_hostfiles[0]); + if (num_user_hostfiles > 0 || num_system_hostfiles > 0) { + error("Add correct host key in %.100s to get rid " + "of this message.", num_user_hostfiles > 0 ? + user_hostfiles[0] : system_hostfiles[0]); + } error("Offending %s key in %s:%lu", sshkey_type(host_found->key), host_found->file, host_found->line);