[PATCH] tests/uname.c: use print_quoted_string to print members of uname
Dmitry V. Levin
ldv at altlinux.org
Thu Mar 24 20:26:34 UTC 2016
On Thu, Mar 24, 2016 at 03:17:48PM +0530, Jay Joshi wrote:
> Patch is attached.
>
> uname.test related question: When will uniq be required?
It was discussed recently, see
https://sourceforge.net/p/strace/mailman/message/34925661/
> Also, is a test for abbreviated output required?
It surely won't harm. :)
> From 05e69fac85562ec3541866caec727d2cf3446590 Mon Sep 17 00:00:00 2001
> From: JayRJoshi <jay.r.joshi100 at gmail.com>
> Date: Thu, 24 Mar 2016 12:39:32 +0530
> Subject: [PATCH 2/2] tests/uname.c: use print_quoted_string
>
> * tests/uname.c: Use print_quoted_string to print members of utsname.
> ---
> tests/uname.c | 28 +++++++++++++++-------------
> 1 file changed, 15 insertions(+), 13 deletions(-)
>
> diff --git a/tests/uname.c b/tests/uname.c
> index 0f1b5f3..6d7e572 100644
> --- a/tests/uname.c
> +++ b/tests/uname.c
> @@ -11,21 +11,23 @@ int main()
> {
> struct utsname *const uname = tail_alloc(sizeof(struct utsname));
> int rc = syscall(__NR_uname, uname);
> - printf("uname({sysname=\"%s\", nodename=\"%s\", release=\"%s\""
> - ", version=\"%s\", machine=\"%s\""
> + printf("uname({sysname=\"");
> + print_quoted_string(uname->sysname);
> + printf("\", nodename=\"");
> + print_quoted_string(uname->nodename);
> + printf("\", release=\"");
> + print_quoted_string(uname->release);
> + printf("\", version=\"");
> + print_quoted_string(uname->version);
> + printf("\", machine=\"");
> + print_quoted_string(uname->machine);
Why these print_quoted_string calls are indented this way?
> + printf("\""
> # ifdef HAVE_STRUCT_UTSNAME_DOMAINNAME
> - ", domainname=\"%s\""
> + ", domainname=\"");
Note the (unintended?) change of indentation here...
> + print_quoted_string(uname->domainname);
> + printf("\""
> # endif
> - "}) = %d\n",
> - uname->sysname,
> - uname->nodename,
> - uname->release,
> - uname->version,
> - uname->machine,
> -# ifdef HAVE_STRUCT_UTSNAME_DOMAINNAME
> - uname->domainname,
> -# endif
> - rc);
> + "}) = %d\n", rc);
... and here.
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160324/15e0e55c/attachment.bin>
More information about the Strace-devel
mailing list