aports/community/pgexporter/fix-stdout-buffering.patch

43 lines
1.2 KiB
Diff

Patch-Source: https://github.com/pgexporter/pgexporter/pull/134
--
From 5a3fccaf71f1d9a31b0958d08a9ccc6b5b50ff6d Mon Sep 17 00:00:00 2001
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Fri, 26 Apr 2024 00:09:16 +0200
Subject: [PATCH] Fix prompts not being printed by disabling stdout buffering
When built against musl libc, prompts like "Master key:", "Username:" etc.
are not printed to console because of stdout buffering.
---
src/admin.c | 3 +++
src/cli.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/src/admin.c b/src/admin.c
index 1a192a8..c5b8cd9 100644
--- a/src/admin.c
+++ b/src/admin.c
@@ -118,6 +118,9 @@ main(int argc, char** argv)
int option_index = 0;
int32_t action = ACTION_UNKNOWN;
+ // Disable stdout buffering (i.e. write to stdout immediatelly).
+ setbuf(stdout, NULL);
+
while (1)
{
static struct option long_options[] =
diff --git a/src/cli.c b/src/cli.c
index 353e1ce..0b52f17 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -134,6 +134,9 @@ main(int argc, char** argv)
char un[MAX_USERNAME_LENGTH];
configuration_t* config = NULL;
+ // Disable stdout buffering (i.e. write to stdout immediatelly).
+ setbuf(stdout, NULL);
+
while (1)
{
static struct option long_options[] =