Mike Bell
2011-Aug-02 04:36 UTC
Adding fflush() to ssh-agent so its output can be redirected to a file
Without this patch "ssh-agent -d > ~/ssh-agent.sh" will produce a zero byte file. Obviously a corner case, but for what I'm doing it's a show-stopper, and it _seems_ like an obvious improvement to correctness, rather than relying on implicit newline flushing with TTYs and flush-on-exit with the forking mode. Not subscribed, so please CC me on any replies. --- ssh-agent.c.orig 2011-08-01 20:42:08.890134187 -0700 +++ ssh-agent.c 2011-08-01 21:13:08.995357974 -0700 @@ -1281,6 +1281,7 @@ printf(format, SSH_AUTHSOCKET_ENV_NAME, socket_name, SSH_AUTHSOCKET_ENV_NAME); printf("echo Agent pid %ld;\n", (long)parent_pid); + fflush(stdout); goto skip; } pid = fork();
Reasonably Related Threads
- [PATCH] ssh-agent: add systemd socket-based activation
- openssh-2.9.9p2 assumes pid_t, uid_t, etc. are not 'long'
- compiler warnings about format strings
- patch for openssh3.5p1 - adds logging option
- [klibc:master] capabilities: Use fflush() instead of fseek ()