mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Workaround for broken C libraries causing stdout redirection for broken libmtp causing stdout to become fully buffered
This commit is contained in:
parent
65d51e3050
commit
22ee6226ce
@ -734,6 +734,7 @@ initlibmtp(void) {
|
|||||||
// who designs a library without anyway to control/redirect the debugging
|
// who designs a library without anyway to control/redirect the debugging
|
||||||
// output, and hardcoded paths that cannot be changed?
|
// output, and hardcoded paths that cannot be changed?
|
||||||
int bak, new;
|
int bak, new;
|
||||||
|
fprintf(stdout, "\n"); // This is needed, without it, for some odd reason the code below causes stdout to buffer all output after it is restored, rather than using line buffering, and setlinebuf does not work.
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
bak = dup(STDOUT_FILENO);
|
bak = dup(STDOUT_FILENO);
|
||||||
new = open("/dev/null", O_WRONLY);
|
new = open("/dev/null", O_WRONLY);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user