On Thu, Dec 22, 2016 at 1:16 PM, Gabriel Laskar <gabr...@lse.epita.fr> wrote: > This fixes the display when using `-s` to limit the string size of the > values displayed by {get,set}xattr. > > Signed-off-by: Gabriel Laskar <gabr...@lse.epita.fr> > Reported-by: Марк Коренберг <socketp...@gmail.com> > > * xattr.c (print_xattr_val): use printstr_ex instead of > print_quoted_string > > Signed-off-by: Gabriel Laskar <gabr...@lse.epita.fr> > --- > xattr.c | 13 +++---------- > 1 file changed, 3 insertions(+), 10 deletions(-)
Could you also add a testcase to tests/xattr.test? > diff --git a/xattr.c b/xattr.c > index 30a8467c..8e22f7eb 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 (!addr || 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); > } > > -- > 2.11.0 > > > ------------------------------------------------------------------------------ > Developer Access Program for Intel Xeon Phi Processors > Access to Intel Xeon Phi processor-based developer platforms. > With one year of Intel Parallel Studio XE. > Training and support from Colfax. > Order your platform today.http://sdm.link/intel > _______________________________________________ > Strace-devel mailing list > Strace-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/strace-devel -- Elvira Khabirova ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today.http://sdm.link/intel _______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel