From: Gabriel Laskar Date: Thu, 22 Dec 2016 15:10:51 +0000 (+0100) Subject: xattr: use printstr_ex instead of print_quoted_string X-Git-Tag: v4.16~294 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dd3548a691dfa8179bf3c1470a9f24127945af8b;p=strace xattr: use printstr_ex instead of print_quoted_string This fixes the display when using `-s` to limit the string size of the values displayed by {get,set}xattr. * xattr.c (print_xattr_val): Remove static buffer. Use printstr_ex instead of print_quoted_string. Reported-by: Марк Коренберг Signed-off-by: Gabriel Laskar --- diff --git a/xattr.c b/xattr.c index 30a8467c..721d39fc 100644 --- a/xattr.c +++ b/xattr.c @@ -45,19 +45,12 @@ print_xattr_val(struct tcb *tcp, unsigned long insize, unsigned long size) { - static char buf[XATTR_SIZE_MAX]; - tprints(", "); - if (!addr || size > sizeof(buf)) + if (size > XATTR_SIZE_MAX) printaddr(addr); - else if (!size || !umoven_or_printaddr(tcp, addr, size, buf)) { - /* Don't print terminating NUL if there is one. */ - if (size && buf[size - 1] == '\0') - --size; - - print_quoted_string(buf, size, 0); - } + else + printstr_ex(tcp, addr, size, QUOTE_OMIT_TRAILING_0); tprintf(", %lu", insize); }