From 084d74801530b14c000b4d3360528af82ca7a8ab Mon Sep 17 00:00:00 2001 From: JingPiao Chen Date: Wed, 14 Jun 2017 11:54:16 +0800 Subject: [PATCH] tests: extend printstr test * tests/printstr.c (main): Add a case for short read. --- tests/printstr.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/printstr.c b/tests/printstr.c index 330234f1..356ae2ec 100644 --- a/tests/printstr.c +++ b/tests/printstr.c @@ -40,7 +40,7 @@ int main(void) { char *const buf = tail_alloc(DEFAULT_STRLEN + 1); - const struct iovec io = { + struct iovec io = { .iov_base = buf, .iov_len = -1 }; @@ -64,6 +64,11 @@ main(void) tprintf("writev(-1, [{iov_base=\"\\0%*s\"..., iov_len=%lu}], 1)" " = %s\n", DEFAULT_STRLEN - 1, buf + 1, -1UL, sprintrc(rc)); + ++io.iov_base; + rc = writev(-1, &io, 1); + tprintf("writev(-1, [{iov_base=%p, iov_len=%lu}], 1) = %s\n", + io.iov_base, -1UL, sprintrc(rc)); + tprintf("+++ exited with 0 +++\n"); return 0; } -- 2.40.0