[prev in list] [next in list] [prev in thread] [next in thread] 

List:       strace
Subject:    Re: [PATCH] xattr: use printstr_ex instead of print_quoted_string
From:       Line Printer <lineprinter0 () gmail ! com>
Date:       2016-12-22 11:13:52
Message-ID: CA++8mrpGGgd35w-4Aiv3QtVFubJUdUH4Dp7G8FCOwq020wuEuw () mail ! gmail ! com
[Download RAW message or body]

On Thu, Dec 22, 2016 at 1:16 PM, Gabriel Laskar <gabriel@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 <gabriel@lse.epita.fr>
> Reported-by: Марк Коренберг <socketpair@gmail.com>
>
> * xattr.c (print_xattr_val): use printstr_ex instead of
> print_quoted_string
>
> Signed-off-by: Gabriel Laskar <gabriel@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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic