Skip to content

Commit

Permalink
2008-04-19 Dmitry V. Levin <ldv@altlinux.org>
Browse files Browse the repository at this point in the history
	* desc.c (sys_fcntl): Do not initialize auxstr for failed syscall.
	* process.c (sys_fork, sys_rfork) [USE_PROCFS]: Likewise.
	* signal.c (sys_signal): Likewise.
	* stream.c (internal_stream_ioctl): Likewise.
	* time.c (sys_adjtimex): Likewise.
	* syscall.c (trace_syscall): If RVAL_STR is set, then
	print auxstr for failed syscall as well.
  • Loading branch information
ldv-alt committed Sep 3, 2008
1 parent 2e55ff4 commit 21a7534
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 5 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
2008-04-19 Dmitry V. Levin <ldv@altlinux.org>

* desc.c (sys_fcntl): Do not initialize auxstr for failed syscall.
* process.c (sys_fork, sys_rfork) [USE_PROCFS]: Likewise.
* signal.c (sys_signal): Likewise.
* stream.c (internal_stream_ioctl): Likewise.
* time.c (sys_adjtimex): Likewise.
* syscall.c (trace_syscall): If RVAL_STR is set, then
print auxstr for failed syscall as well.

* syscall.c (is_restart_error): New function.
* defs.h (is_restart_error): Declare it.

Expand Down
4 changes: 3 additions & 1 deletion desc.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,12 +332,14 @@ sys_fcntl(struct tcb *tcp)
case F_SETOWN: case F_GETOWN:
break;
case F_GETFD:
if (tcp->u_rval == 0)
if (syserror(tcp) || tcp->u_rval == 0)
return 0;
tcp->auxstr =
sprintflags("flags ", fdflags, tcp->u_rval);
return RVAL_HEX|RVAL_STR;
case F_GETFL:
if (syserror(tcp))
return 0;
tcp->auxstr = sprint_open_modes(tcp->u_rval);
return RVAL_HEX|RVAL_STR;
case F_GETLK:
Expand Down
4 changes: 2 additions & 2 deletions process.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ int
sys_fork(tcp)
struct tcb *tcp;
{
if (exiting(tcp)) {
if (exiting(tcp) && !syserror(tcp)) {
if (getrval2(tcp)) {
tcp->auxstr = "child process";
return RVAL_UDECIMAL | RVAL_STR;
Expand All @@ -516,7 +516,7 @@ struct tcb *tcp;
if (entering(tcp)) {
tprintf ("%ld", tcp->u_arg[0]);
}
else {
else if (!syserror(tcp)) {
if (getrval2(tcp)) {
tcp->auxstr = "child process";
return RVAL_UDECIMAL | RVAL_STR;
Expand Down
3 changes: 2 additions & 1 deletion signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1199,7 +1199,7 @@ struct tcb *tcp;
}
return 0;
}
else {
else if (!syserror(tcp)) {
switch (tcp->u_rval) {
case (long) SIG_ERR:
tcp->auxstr = "SIG_ERR"; break;
Expand All @@ -1212,6 +1212,7 @@ struct tcb *tcp;
}
return RVAL_HEX | RVAL_STR;
}
return 0;
}

#ifdef SVR4
Expand Down
2 changes: 1 addition & 1 deletion stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,7 @@ int arg;
}
if (exiting(tcp)) {
tprintf("}");
if (timod && tcp->u_rval) {
if (timod && tcp->u_rval && !syserror(tcp)) {
tcp->auxstr = xlookup (tli_errors, tcp->u_rval);
return RVAL_STR + 1;
}
Expand Down
2 changes: 2 additions & 0 deletions syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -2369,6 +2369,8 @@ trace_syscall(struct tcb *tcp)
strerror(u_error));
break;
}
if ((sys_res & RVAL_STR) && tcp->auxstr)
tprintf(" (%s)", tcp->auxstr);
}
else {
if (sys_res & RVAL_NONE)
Expand Down
2 changes: 2 additions & 0 deletions time.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,8 @@ sys_adjtimex(struct tcb *tcp)
tprintf("%#lx", tcp->u_arg[0]);
else if (tprint_timex(tcp, tcp->u_arg[0]) < 0)
tprintf("{...}");
if (syserror(tcp))
return 0;
tcp->auxstr = xlookup(adjtimex_state, tcp->u_rval);
if (tcp->auxstr)
return RVAL_STR;
Expand Down

0 comments on commit 21a7534

Please sign in to comment.