void-packages/srcpkgs/ltrace/patches/musl-ppc.patch
Đoàn Trần Công Danh 861ac185a6 srcpkgs/l*: 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

36 lines
776 B
Diff

--- a/sysdeps/linux-gnu/ppc/regs.c
+++ b/sysdeps/linux-gnu/ppc/regs.c
@@ -27,7 +27,9 @@
#include <sys/ptrace.h>
#include <asm/ptrace.h>
#include <errno.h>
+#ifdef __GLIBC__
#include <error.h>
+#endif
#include "proc.h"
#include "common.h"
@@ -50,7 +52,13 @@ void
set_instruction_pointer(struct process *proc, void *addr)
{
if (ptrace(PTRACE_POKEUSER, proc->pid, sizeof(long)*PT_NIP, addr) != 0)
+ {
+#ifdef __GLIBC__
error(0, errno, "set_instruction_pointer");
+#else
+ fprintf(stderr, "set_instruction_pointer: %s\n", strerror(errno));
+#endif
+ }
}
void *
--- a/sysdeps/linux-gnu/ppc/trace.c
+++ b/sysdeps/linux-gnu/ppc/trace.c
@@ -24,6 +24,7 @@
#include "config.h"
+#include <asm/ptrace.h>
#include <assert.h>
#include <elf.h>
#include <errno.h>