diff options
author | Bart Van Assche <bart.vanassche@sandisk.com> | 2015-02-06 13:36:26 +0100 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2015-02-08 01:42:00 +0000 |
commit | 0014bb1b9dbb6c255b40ceb7b71c60bd198b41b2 (patch) | |
tree | 73a8e558cbcda7c00438de3f3d26a59a6a10b679 /scsi.c | |
parent | ea6972c1625b47baabbe4fa8ac009e31901c11bd (diff) | |
download | strace-0014bb1b9dbb6c255b40ceb7b71c60bd198b41b2.tar.gz |
scsi: on exit, print only initialized part of the buffer
* scsi.c (print_sg_io_res): Only print that part of the data in buffer
that has been initialized by the SCSI LLD driver.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Diffstat (limited to 'scsi.c')
-rw-r--r-- | scsi.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -88,9 +88,13 @@ print_sg_io_res(struct tcb *tcp, struct sg_io_hdr *sg_io) { if (sg_io->dxfer_direction == SG_DXFER_FROM_DEV || sg_io->dxfer_direction == SG_DXFER_TO_FROM_DEV) { - tprintf(", data[%u]=[", sg_io->dxfer_len); - printstr(tcp, (unsigned long) sg_io->dxferp, - sg_io->dxfer_len); + uint32_t din_len = sg_io->dxfer_len; + + if (sg_io->resid > 0) + din_len -= sg_io->resid; + + tprintf(", data[%u]=[", din_len); + printstr(tcp, (unsigned long) sg_io->dxferp, din_len); tprints("]"); } tprintf(", status=%02x, ", sg_io->status); |