Fix printing of unreadable struct iovec
* io.c (tprint_iov_upto): If the first element of iovec array is unreadable, print its address without array markup. * tests/readv.c (main): Check it.
This commit is contained in:
parent
5dde5671bd
commit
0a9d1947a7
19
io.c
19
io.c
@ -86,17 +86,23 @@ tprint_iov_upto(struct tcb *tcp, unsigned long len, unsigned long addr, int deco
|
||||
} else {
|
||||
abbrev_end = end;
|
||||
}
|
||||
tprints("[");
|
||||
if (addr >= abbrev_end) {
|
||||
tprints("[...]");
|
||||
return;
|
||||
}
|
||||
for (cur = addr; cur < end; cur += sizeof_iov) {
|
||||
if (cur > addr)
|
||||
if (cur > addr) {
|
||||
tprints(", ");
|
||||
if (cur >= abbrev_end) {
|
||||
tprints("...");
|
||||
break;
|
||||
if (cur >= abbrev_end) {
|
||||
tprints("...");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (umove_ulong_array_or_printaddr(tcp, cur, iov,
|
||||
ARRAY_SIZE(iov)))
|
||||
break;
|
||||
if (cur <= addr)
|
||||
tprints("[");
|
||||
tprints("{");
|
||||
if (decode_iov) {
|
||||
unsigned long len = iov[1];
|
||||
@ -108,7 +114,8 @@ tprint_iov_upto(struct tcb *tcp, unsigned long len, unsigned long addr, int deco
|
||||
printaddr(iov[0]);
|
||||
tprintf(", %lu}", iov[1]);
|
||||
}
|
||||
tprints("]");
|
||||
if (cur > addr)
|
||||
tprints("]");
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -60,7 +60,7 @@ main(void)
|
||||
void *w2 = tail_memdup(w2_c, LENGTH_OF(w2_c));
|
||||
|
||||
assert(writev(1, efault, 42) == -1);
|
||||
tprintf("writev(1, [%p], 42) = -1 EFAULT (%m)\n", efault);
|
||||
tprintf("writev(1, %p, 42) = -1 EFAULT (%m)\n", efault);
|
||||
|
||||
assert(readv(0, efault, 42) == -1);
|
||||
tprintf("readv(0, %p, 42) = -1 EFAULT (%m)\n", efault);
|
||||
|
Loading…
x
Reference in New Issue
Block a user