From: Eugene Syromyatnikov Date: Fri, 2 Feb 2018 18:06:31 +0000 (+0100) Subject: util.c: escape closing angle bracket in printfd X-Git-Tag: v4.22~135 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6d36a7086813ca2b4670c33be688020425fc7a72;p=strace util.c: escape closing angle bracket in printfd * util.c (printfd): Use print_quoted_string_ex instead of print_quoted_string, specify ">" as escape_chars argument. * tests/fsync-y.c (main): Update expected output. * NEWS: Mention it. --- diff --git a/NEWS b/NEWS index 969d585d..cd85c097 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,10 @@ Noteworthy changes in release ?.?? (????-??-??) * Changes in infrastructure * The mailing list was moved to strace-devel@lists.strace.io. +* Changes in behaviour + * Closing angle bracket is now printed as an octal number escape sequence + in the output of paths associated with file descriptors. + * Improvements * IPv6 addresses shown in socket information in -yy mode are now printed in brackets. diff --git a/tests/fsync-y.c b/tests/fsync-y.c index f8bf0f96..df4b1088 100644 --- a/tests/fsync-y.c +++ b/tests/fsync-y.c @@ -46,7 +46,7 @@ main(void) } checks[] = { { ARG_STR("\1\0020\v\0047\f\58\t\79\n\10\0171\r\0167\218\37 \\\'\"<<0::0>>1~\177\200\377"), "\\1\\0020\\v\\0047\\f\\58\\t\\79\\n\\10\\0171\\r\\0167" - "\\218\\37 \\\\\'\\\"<<0::0>>1~\\177\\200\\377" }, + "\\218\\37 \\\\\'\\\"<<0::0\\76\\0761~\\177\\200\\377" }, }; if (!getcwd(dir, sizeof(dir))) @@ -60,7 +60,7 @@ main(void) int rc = fsync(fd); printf("fsync(%ld<", fd); - print_quoted_string_ex(dir, false, NULL); + print_quoted_string_ex(dir, false, ">"); printf("/%s>) = %s\n", checks[i].fdstr, sprintrc(rc)); close(fd); diff --git a/util.c b/util.c index 2758bf01..78aad90b 100644 --- a/util.c +++ b/util.c @@ -434,8 +434,8 @@ printfd(struct tcb *tcp, int fd) || str[len - 1] != ']' || !(inode = strtoul(str, NULL, 10)) || !print_sockaddr_by_inode(tcp, fd, inode)) { - print_quoted_string(path, strlen(path), - QUOTE_OMIT_LEADING_TRAILING_QUOTES); + print_quoted_string_ex(path, strlen(path), + QUOTE_OMIT_LEADING_TRAILING_QUOTES, ">"); } tprints(">"); } else