32 lines
1.1 KiB
Diff
32 lines
1.1 KiB
Diff
We can't assign to *stdout and *stderr with musl libc
|
|
because both file pointers are const.
|
|
|
|
--- a/src/main.cc 2014-12-19 22:24:38.000000000 +0100
|
|
+++ b/src/main.cc 2015-11-19 13:53:23.419299858 +0100
|
|
@@ -301,21 +301,25 @@
|
|
if (ap.redirect) {
|
|
FILE *newfp;
|
|
newfp = std::freopen((userStdPath + "/Output.log").c_str(), "w", stdout);
|
|
+#if defined(__GLIBC__)
|
|
if ( newfp == NULL ) { // This happens on NT
|
|
newfp = fopen((userStdPath + "/Output.log").c_str(), "w");
|
|
if (newfp) { // in case stdout is a macro
|
|
*stdout = *newfp;
|
|
}
|
|
}
|
|
+#endif
|
|
setvbuf(stdout, NULL, _IOLBF, BUFSIZ); // Line buffered
|
|
|
|
newfp = std::freopen((userStdPath + "/Error.log").c_str(), "w", stderr);
|
|
+#if defined(__GLIBC__)
|
|
if ( newfp == NULL ) { // This happens on NT
|
|
newfp = fopen((userStdPath + "/Error.log").c_str(), "w");
|
|
if (newfp) { // in case stderr is a macro
|
|
*stderr = *newfp;
|
|
}
|
|
}
|
|
+#endif
|
|
setbuf(stderr, NULL); // No buffering
|
|
}
|
|
|