]> granicus.if.org Git - strace/commitdiff
Remove RVAL_PRINT_ERR_VAL
authorDmitry V. Levin <ldv@altlinux.org>
Thu, 29 Mar 2018 16:00:18 +0000 (16:00 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 29 Mar 2018 16:00:18 +0000 (16:00 +0000)
* defs.h (RVAL_PRINT_ERR_VAL): Remove.
* ldt.c (SYS_FUNC(modify_ldt)): Return 0.
* syscall.c (syscall_exiting_trace): When printing an error,
always print struct tcb.u_rval as if RVAL_PRINT_ERR_VAL was set.

defs.h
ldt.c
syscall.c

diff --git a/defs.h b/defs.h
index 4f000eec58b01ba210b1b42fcab5f4b5304f7dba..abe81c335442a7fa018a224ff5094c8355dfdd83 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -332,10 +332,6 @@ extern const struct xlat whence_codes[];
 #define RVAL_DECODED   0100    /* syscall decoding finished */
 #define RVAL_IOCTL_DECODED 0200        /* ioctl sub-parser successfully decoded
                                   the argument */
-#define RVAL_PRINT_ERR_VAL 0400 /* Print decoded error code along with
-                                  syscall return value.  Needed for modify_ldt
-                                  that for some reason decides to return
-                                  an error with higher bits set to 0.  */
 
 #define IOCTL_NUMBER_UNKNOWN 0
 #define IOCTL_NUMBER_HANDLED 1
diff --git a/ldt.c b/ldt.c
index 682847ed06b3dbb56aa96e0f543ea7339f034232..104abc315da6cb2b20db26221c8e8bcc0ec5bc8a 100644 (file)
--- a/ldt.c
+++ b/ldt.c
@@ -155,7 +155,7 @@ SYS_FUNC(modify_ldt)
 
        tcp->u_error = -(unsigned int) tcp->u_rval;
 
-       return RVAL_PRINT_ERR_VAL;
+       return 0;
 }
 
 SYS_FUNC(set_thread_area)
index 367e955d376168891bec44fd42054f59ae1c524f..363ac74c0d01ce0694f892374bf3226547e4964e 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -821,7 +821,6 @@ syscall_exiting_trace(struct tcb *tcp, struct timespec *ts, int res)
        tprints(") ");
        tabto();
        unsigned long u_error = tcp->u_error;
-       kernel_long_t u_rval;
 
        if (raw(tcp)) {
                if (u_error) {
@@ -889,15 +888,13 @@ syscall_exiting_trace(struct tcb *tcp, struct timespec *ts, int res)
                        tprints("= ? ERESTART_RESTARTBLOCK (Interrupted by signal)");
                        break;
                default:
-                       u_rval = sys_res & RVAL_PRINT_ERR_VAL ?
-                                tcp->u_rval : -1;
                        u_error_str = err_name(u_error);
                        if (u_error_str)
-                               tprintf("= %" PRI_kld " %s (%s)",
-                                       u_rval, u_error_str, strerror(u_error));
+                               tprintf("= %" PRI_kld " %s (%s)", tcp->u_rval,
+                                       u_error_str, strerror(u_error));
                        else
-                               tprintf("= %" PRI_kld " %lu (%s)",
-                                       u_rval, u_error, strerror(u_error));
+                               tprintf("= %" PRI_kld " %lu (%s)", tcp->u_rval,
+                                       u_error, strerror(u_error));
                        break;
                }
                if (syscall_tampered(tcp))