]> granicus.if.org Git - strace/commitdiff
util.c: escape closing angle bracket in printfd
authorEugene Syromyatnikov <evgsyr@gmail.com>
Fri, 2 Feb 2018 18:06:31 +0000 (19:06 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 1 Mar 2018 01:00:24 +0000 (01:00 +0000)
* 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.

NEWS
tests/fsync-y.c
util.c

diff --git a/NEWS b/NEWS
index 969d585d0507933d0639c5e57f1f6de890aa68ad..cd85c097c9f186b0c7a92e42ffa6e2c13227ccdf 100644 (file)
--- 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.
index f8bf0f9630717d878491afbac7db7c1e0dca6061..df4b1088f7fd1e3bf8ea01edcad25f0e42144597 100644 (file)
@@ -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 2758bf01c44c06fc7d775c72acc4be45d38fc74f..78aad90b268330172cf2dd8093fb8d366a18e916 100644 (file)
--- 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