Fix readlink result display - was printing bogus "..." semi-randomly
* file.c (decode_readlink): Use printstr() instead of printpathn().
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/file.c b/file.c
index 343f64a..b2567c5 100644
--- a/file.c
+++ b/file.c
@@ -2048,7 +2048,14 @@
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;