From d551f330435da6a5971ce9511fa25666f976ce1b Mon Sep 17 00:00:00 2001 From: KO Myung-Hun Date: Sun, 16 Jun 2024 19:50:47 +0900 Subject: [PATCH] Flush a stream of stdout explicitly Without flushing a stream which is a socket on exit, buffered outputs are lost. This seems to be a bug of OS/2 kLIBC. Fixed #6. modified: builtin/credential-store.c --- builtin/credential-store.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/builtin/credential-store.c b/builtin/credential-store.c index 4a492411..b10b4972 100644 --- a/builtin/credential-store.c +++ b/builtin/credential-store.c @@ -52,6 +52,11 @@ static void print_entry(struct credential *c) { printf("username=%s\n", c->username); printf("password=%s\n", c->password); + /* + * OS/2 kLIBC requires to flush a stream explicitly when it is a socket. + * Otherwise, buffered outputs are lost. + */ + fflush(stdout); } static void print_line(struct strbuf *buf)