void-packages/srcpkgs/enigma/patches/musl-redirect.patch
Đoàn Trần Công Danh a03d116397 srcpkgs/e*: convert patches to -Np1
```sh

git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

31 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
}