On Thu, Jul 06, 2017 at 09:57:28AM +0800, JingPiao Chen wrote:
> * nlattr.c (decode_nlattr_with_data): Replace printstrn
> with printstr_ex and set QUOTE_FORCE_HEX flag.
> * tests/print_quoted_string.c (print_quoted_hex): New function.
> * tests/test_nlattr.h (print_quoted_hex): New prototype.
> * tests/tests.h (TEST_NLATTR_OBJECT, TEST_NLATTR_ARRAY): Use it
> for update expected output.
> * tests/nlattr.c: Update expected output.
[...]
> --- a/tests/test_nlattr.h
> +++ b/tests/test_nlattr.h
> @@ -107,7 +107,7 @@ print_nlattr(const unsigned int nla_len, const char
> *const nla_type)
> (nla_type_), #nla_type_, \
> sizeof(obj_) - 1, \
> (pattern_), sizeof(obj_) - 1, \
> - printf("\"%.*s\"", plen, (pattern_))); \
> + print_quoted_hex((pattern_), plen)); \
> /* short read of sizeof(obj_) */ \
> TEST_NLATTR_((fd_), (nlh0_), (hdrlen_), \
> (init_msg_), (print_msg_), \
> @@ -138,7 +138,7 @@ print_nlattr(const unsigned int nla_len, const char
> *const nla_type)
> (nla_type_), #nla_type_, \
> sizeof((obj_)[0]) - 1, \
> (pattern_), sizeof((obj_)[0]) - 1, \
> - printf("\"%.*s\"", plen, (pattern_))); \
> + print_quoted_hex((pattern_), plen)); \
> /* sizeof((obj_)[0]) < len < sizeof(obj_) */ \
> TEST_NLATTR_((fd_), (nlh0_), (hdrlen_), \
> (init_msg_), (print_msg_), \Please change the type of "plen" variable to unsigned int along with this change. > diff --git a/tests/tests.h b/tests/tests.h > index 094f365..6332e71 100644 > --- a/tests/tests.h > +++ b/tests/tests.h > @@ -137,6 +137,9 @@ void print_quoted_string(const char *); > /* Print memory in a quoted form. */ > void print_quoted_memory(const char *, size_t); > > +/* Print hex in a quoted form. */ Print memory in a hexquoted form. > +void print_quoted_hex(const char *, size_t); > + > /* Print time_t and nanoseconds in symbolic format. */ > void print_time_t_nsec(time_t, unsigned long long, int); -- ldv
signature.asc
Description: PGP signature
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Strace-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/strace-devel
