From: Denys Vlasenko Date: Fri, 27 Jan 2012 16:24:26 +0000 (+0100) Subject: Fix readlink result display - was printing bogus "..." semi-randomly X-Git-Tag: v4.7~193 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3449ae83c26d159dddc8573dc22b867feb0f49c6;p=strace Fix readlink result display - was printing bogus "..." semi-randomly * file.c (decode_readlink): Use printstr() instead of printpathn(). Signed-off-by: Denys Vlasenko --- diff --git a/file.c b/file.c index 343f64a5..b2567c5b 100644 --- a/file.c +++ b/file.c @@ -2048,7 +2048,14 @@ decode_readlink(struct tcb *tcp, int offset) if (syserror(tcp)) tprintf("%#lx", tcp->u_arg[offset + 1]); else - printpathn(tcp, tcp->u_arg[offset + 1], tcp->u_rval); + /* Used to use printpathn(), but readlink + * neither includes NUL in the returned count, + * nor actually writes it into memory. + * printpathn() would decide on printing + * "..." continuation based on garbage + * past return buffer's end. + */ + printstr(tcp, tcp->u_arg[offset + 1], tcp->u_rval); tprintf(", %lu", tcp->u_arg[offset + 2]); } return 0;