[openssh-commits] [openssh] 14/14: upstream: fix -Wuninitialized from previous

git+noreply at mindrot.org git+noreply at mindrot.org
Thu Nov 26 10:20:59 AEDT 2026


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit baffa08fdc958ebfea9b57d1fda56d7aa3320422
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Wed Nov 25 23:17:47 2026 +0000

    upstream: fix -Wuninitialized from previous
    
    OpenBSD-Commit-ID: b02772d7e0678a86cb6934823d35ec2c3080bff8
---
 ssh-keygen.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ssh-keygen.c b/ssh-keygen.c
index 3008b0321..80f94b8f0 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keygen.c,v 1.502 2026/11/25 08:48:52 djm Exp $ */
+/* $OpenBSD: ssh-keygen.c,v 1.503 2026/11/25 23:17:47 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
  * Copyright (c) 1994 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -1295,7 +1295,7 @@ do_known_hosts(struct passwd *pw, const char *name, int find_host,
     int delete_host, int hash_hosts)
 {
 	char *cp, tmp[PATH_MAX], old[PATH_MAX];
-	int r, fd, infd, oerrno, inplace;
+	int r, fd = -1, infd, oerrno, inplace;
 	struct known_hosts_ctx ctx;
 	u_int foreach_options;
 	struct stat sb;
@@ -1371,7 +1371,7 @@ do_known_hosts(struct passwd *pw, const char *name, int find_host,
 		 * Keep the copy private unless it is about to replace the
 		 * original, in which case it inherits the original's mode.
 		 */
-		if (!ctx.invalid && (!delete_host || ctx.found_key))
+		if (!ctx.invalid && (!delete_host || ctx.found_key) && fd != -1)
 			(void)fchmod(fd, sb.st_mode & 0644);
 		if (ferror(ctx.out) || fclose(ctx.out) != 0) {
 			oerrno = errno;

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list