]> granicus.if.org Git - strace/commitdiff
2004-07-08 Roland McGrath <roland@redhat.com>
authorRoland McGrath <roland@redhat.com>
Thu, 8 Jul 2004 19:00:04 +0000 (19:00 +0000)
committerRoland McGrath <roland@redhat.com>
Thu, 8 Jul 2004 19:00:04 +0000 (19:00 +0000)
* resource.c (sys_quotactl): Truncate first argument to 32 bits, since
that's what the kernel will do.

resource.c

index 4692a37b76aff102371caad2d03f601104155f55..3bb464a0ed3e326349ee6d13a6b929e88016a231 100644 (file)
@@ -498,10 +498,18 @@ int
 sys_quotactl(tcp)
 struct tcb *tcp;
 {
+       /*
+        * The Linux kernel only looks at the low 32 bits of the command
+        * argument, but on some 64-bit architectures (s390x) this word
+        * will have been sign-extended when we see it.  The high 1 bits
+        * don't mean anything, so don't confuse the output with them.
+        */
+       unsigned int cmd = tcp->u_arg[0];
+
        if (entering(tcp)) {
-               printxval(quotacmds, (unsigned long) tcp->u_arg[0] >> SUBCMDSHIFT, "Q_???");
+               printxval(quotacmds, cmd >> SUBCMDSHIFT, "Q_???");
                tprintf("|");
-               printxval(quotatypes, tcp->u_arg[0] & SUBCMDMASK, "???QUOTA");
+               printxval(quotatypes, cmd & SUBCMDMASK, "???QUOTA");
                tprintf(", ");
                printstr(tcp, tcp->u_arg[1], -1);
                tprintf(", %lu, ", tcp->u_arg[2]);
@@ -511,7 +519,7 @@ struct tcb *tcp;
 
                if (!tcp->u_arg[3])
                        tprintf("NULL");
-               else if (!verbose(tcp) || !OLD_COMMAND(tcp->u_arg[0]))
+               else if (!verbose(tcp) || !OLD_COMMAND(cmd))
                        tprintf("%#lx", tcp->u_arg[3]);
                 else if (umoven(tcp, tcp->u_arg[3], sizeof(struct dqblk),
                     (char *) &dq) < 0)