Skip to content

Commit b9bdfb4

Browse files
authored
Merge pull request #1059 from lupo1977/L1-Prod
Fix Issue #1058
2 parents 23e46f5 + a6aad9e commit b9bdfb4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ssh-keygen.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,9 +1544,16 @@ do_change_comment(struct passwd *pw)
15441544
fd = open(identity_file, O_WRONLY | O_CREAT | O_TRUNC, 0644);
15451545
if (fd == -1)
15461546
fatal("Could not save your public key in %s", identity_file);
1547+
#ifdef WINDOWS
1548+
/* Windows POSIX adpater does not support fdopen() on open(file)*/
1549+
close(fd);
1550+
if ((f = fopen(identity_file, "w")) == NULL)
1551+
fatal("fopen %s failed: %s", identity_file, strerror(errno));
1552+
#else /* !WINDOWS */
15471553
f = fdopen(fd, "w");
15481554
if (f == NULL)
15491555
fatal("fdopen %s failed: %s", identity_file, strerror(errno));
1556+
#endif /* !WINDOWS */
15501557
if ((r = sshkey_write(public, f)) != 0)
15511558
fatal("write key failed: %s", ssh_err(r));
15521559
sshkey_free(public);

0 commit comments

Comments
 (0)