https://bugzilla.mindrot.org/show_bug.cgi?id=3529
--- Comment #5 from Mike <[email protected]> --- (In reply to Darren Tucker from comment #2) > Created attachment 3656 [details] > Check for newline at end of known_hosts and add it missing. Close > FILE * if write fails. > > Please try this one instead. I've tested it and for a file which already was terminated with a new-line it still added an extra new-line. I've changed the open mode to `a+` since that should be used for both appending and reading the file. I also had to change the initial fseek to `fseek(f, -1, SEEK_END)`. The docs (https://www.man7.org/linux/man-pages/man3/fopen.3.html) mention the following: > Open for reading and appending (writing at end of file). > The file is created if it does not exist. Output is > always appended to the end of the file. POSIX is silent > on what the initial read position is when using this mode. > For glibc, the initial file position for reading is at the > beginning of the file, but for Android/BSD/MacOS, the > initial file position for reading is at the end of the > file. The attachement was added in my previous comment. -- You are receiving this mail because: You are watching the assignee of the bug. You are watching someone on the CC list of the bug. _______________________________________________ openssh-bugs mailing list [email protected] https://lists.mindrot.org/mailman/listinfo/openssh-bugs
