Use perror_msg instead of perror
* signal.c (sys_sigreturn): Use perror_msg instead of perror. * strace.c (tprintf, tprints, detach, startup_attach): Likewise. * syscall.c (get_scno): Likewise. * util.c (umoven, umovestr): Likewise.
This commit is contained in:
parent
4411a0ce30
commit
9a71bcdab2
8
signal.c
8
signal.c
@ -990,12 +990,12 @@ sys_sigreturn(struct tcb *tcp)
|
||||
m_siginfo_t si;
|
||||
sigset_t sigm;
|
||||
if (ptrace(PTRACE_GETREGS, tcp->pid, (char *)®s, 0) < 0) {
|
||||
perror("sigreturn: PTRACE_GETREGS");
|
||||
perror_msg("%s", "sigreturn: PTRACE_GETREGS");
|
||||
return 0;
|
||||
}
|
||||
i1 = regs.u_regs[U_REG_O1];
|
||||
if (umove(tcp, i1, &si) < 0) {
|
||||
perror("sigreturn: umove");
|
||||
perror_msg("%s", "sigreturn: umove");
|
||||
return 0;
|
||||
}
|
||||
long_to_sigset(si.si_mask, &sigm);
|
||||
@ -1024,7 +1024,7 @@ sys_sigreturn(struct tcb *tcp)
|
||||
m_siginfo_t si;
|
||||
sigset_t sigm;
|
||||
if (ptrace(PTRACE_GETREGS, tcp->pid, (char *)®s, 0) < 0) {
|
||||
perror("sigreturn: PTRACE_GETREGS");
|
||||
perror_msg("%s", "sigreturn: PTRACE_GETREGS");
|
||||
return 0;
|
||||
}
|
||||
sp = regs.regs[29];
|
||||
@ -1039,7 +1039,7 @@ sys_sigreturn(struct tcb *tcp)
|
||||
long regs[PT_MAX+1];
|
||||
sigset_t sigm;
|
||||
if (ptrace(PTRACE_GETREGS, tcp->pid, NULL, (long)regs) < 0) {
|
||||
perror("sigreturn: PTRACE_GETREGS");
|
||||
perror_msg("%s", "sigreturn: PTRACE_GETREGS");
|
||||
return 0;
|
||||
}
|
||||
if (umove(tcp, regs[PT_USP], &sc) < 0)
|
||||
|
21
strace.c
21
strace.c
@ -515,8 +515,7 @@ tprintf(const char *fmt, ...)
|
||||
int n = strace_vfprintf(current_tcp->outf, fmt, args);
|
||||
if (n < 0) {
|
||||
if (current_tcp->outf != stderr)
|
||||
perror(outfname == NULL
|
||||
? "<writing to pipe>" : outfname);
|
||||
perror_msg("%s", outfname);
|
||||
} else
|
||||
current_tcp->curcol += n;
|
||||
}
|
||||
@ -533,7 +532,7 @@ tprints(const char *str)
|
||||
return;
|
||||
}
|
||||
if (current_tcp->outf != stderr)
|
||||
perror(!outfname ? "<writing to pipe>" : outfname);
|
||||
perror_msg("%s", outfname);
|
||||
}
|
||||
}
|
||||
|
||||
@ -750,15 +749,15 @@ detach(struct tcb *tcp)
|
||||
}
|
||||
else if (errno != ESRCH) {
|
||||
/* Shouldn't happen. */
|
||||
perror("detach: ptrace(PTRACE_DETACH, ...)");
|
||||
perror_msg("%s", "detach: ptrace(PTRACE_DETACH, ...)");
|
||||
}
|
||||
else if (my_tkill(tcp->pid, 0) < 0) {
|
||||
if (errno != ESRCH)
|
||||
perror("detach: checking sanity");
|
||||
perror_msg("%s", "detach: checking sanity");
|
||||
}
|
||||
else if (!sigstop_expected && my_tkill(tcp->pid, SIGSTOP) < 0) {
|
||||
if (errno != ESRCH)
|
||||
perror("detach: stopping child");
|
||||
perror_msg("%s", "detach: stopping child");
|
||||
}
|
||||
else
|
||||
sigstop_expected = 1;
|
||||
@ -771,21 +770,21 @@ detach(struct tcb *tcp)
|
||||
if (errno == ECHILD) /* Already gone. */
|
||||
break;
|
||||
if (errno != EINVAL) {
|
||||
perror("detach: waiting");
|
||||
perror_msg("%s", "detach: waiting");
|
||||
break;
|
||||
}
|
||||
#endif /* __WALL */
|
||||
/* No __WALL here. */
|
||||
if (waitpid(tcp->pid, &status, 0) < 0) {
|
||||
if (errno != ECHILD) {
|
||||
perror("detach: waiting");
|
||||
perror_msg("%s", "detach: waiting");
|
||||
break;
|
||||
}
|
||||
#ifdef __WCLONE
|
||||
/* If no processes, try clones. */
|
||||
if (waitpid(tcp->pid, &status, __WCLONE) < 0) {
|
||||
if (errno != ECHILD)
|
||||
perror("detach: waiting");
|
||||
perror_msg("%s", "detach: waiting");
|
||||
break;
|
||||
}
|
||||
#endif /* __WCLONE */
|
||||
@ -934,7 +933,7 @@ startup_attach(void)
|
||||
}
|
||||
ntid -= nerr;
|
||||
if (ntid == 0) {
|
||||
perror("attach: ptrace(PTRACE_ATTACH, ...)");
|
||||
perror_msg("%s", "attach: ptrace(PTRACE_ATTACH, ...)");
|
||||
droptcb(tcp);
|
||||
continue;
|
||||
}
|
||||
@ -955,7 +954,7 @@ startup_attach(void)
|
||||
} /* if (opendir worked) */
|
||||
} /* if (-f) */
|
||||
if (ptrace_attach_or_seize(tcp->pid) < 0) {
|
||||
perror("attach: ptrace(PTRACE_ATTACH, ...)");
|
||||
perror_msg("%s", "attach: ptrace(PTRACE_ATTACH, ...)");
|
||||
droptcb(tcp);
|
||||
continue;
|
||||
}
|
||||
|
@ -721,7 +721,7 @@ get_scno(struct tcb *tcp)
|
||||
errno = 0;
|
||||
opcode = ptrace(PTRACE_PEEKTEXT, tcp->pid, (char *)(pc-sizeof(long)), 0);
|
||||
if (errno) {
|
||||
perror("peektext(pc-oneword)");
|
||||
perror_msg("%s", "peektext(pc-oneword)");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
15
util.c
15
util.c
@ -789,9 +789,10 @@ umoven(struct tcb *tcp, long addr, int len, char *laddr)
|
||||
if (r < 0) {
|
||||
if (errno == ENOSYS)
|
||||
process_vm_readv_not_supported = 1;
|
||||
else if (errno != EINVAL && errno != ESRCH) /* EINVAL is seen if process is gone */
|
||||
/* strange... */
|
||||
perror("process_vm_readv");
|
||||
else if (errno != EINVAL && errno != ESRCH)
|
||||
/* EINVAL or ESRCH could be seen if process is gone,
|
||||
* all the rest is strange and should be reported. */
|
||||
perror_msg("%s", "process_vm_readv");
|
||||
goto vm_readv_didnt_work;
|
||||
}
|
||||
return r;
|
||||
@ -899,9 +900,11 @@ umovestr(struct tcb *tcp, long addr, int len, char *laddr)
|
||||
if (r < 0) {
|
||||
if (errno == ENOSYS)
|
||||
process_vm_readv_not_supported = 1;
|
||||
else if (errno != EINVAL && errno != ESRCH) /* EINVAL is seen if process is gone */
|
||||
/* strange... */
|
||||
perror("process_vm_readv");
|
||||
else if (errno != EINVAL && errno != ESRCH)
|
||||
/* EINVAL or ESRCH could be seen
|
||||
* if process is gone, all the rest
|
||||
* is strange and should be reported. */
|
||||
perror_msg("%s", "process_vm_readv");
|
||||
goto vm_readv_didnt_work;
|
||||
}
|
||||
if (memchr(local[0].iov_base, '\0', r))
|
||||
|
Loading…
x
Reference in New Issue
Block a user