Blame SOURCES/strace-rh1377847.patch

384337
diff -rup a/open.c b/open.c
384337
--- a/open.c	2017-03-27 13:09:44.077819446 -0400
384337
+++ b/open.c	2017-03-27 13:10:05.300586883 -0400
384337
@@ -36,6 +36,10 @@
384337
 
384337
 #include <fcntl.h>
384337
 
384337
+#ifndef O_TMPFILE
384337
+#define O_TMPFILE 020000000
384337
+#endif
384337
+
384337
 #ifdef O_LARGEFILE
384337
 # if O_LARGEFILE == 0          /* biarch platforms in 64-bit mode */
384337
 #  undef O_LARGEFILE
384337
@@ -115,6 +119,13 @@ tprint_open_modes(unsigned int flags)
384337
 	tprints(sprint_open_modes(flags) + sizeof("flags"));
384337
 }
384337
 
384337
+#ifdef O_TMPFILE
384337
+/* The kernel & C libraries often inline O_DIRECTORY. */
384337
+# define STRACE_O_TMPFILE (O_TMPFILE & ~O_DIRECTORY)
384337
+#else /* !O_TMPFILE */
384337
+# define STRACE_O_TMPFILE 0
384337
+#endif
384337
+
384337
 static int
384337
 decode_open(struct tcb *tcp, int offset)
384337
 {
384337
@@ -122,7 +133,7 @@ decode_open(struct tcb *tcp, int offset)
384337
 	tprints(", ");
384337
 	/* flags */
384337
 	tprint_open_modes(tcp->u_arg[offset + 1]);
384337
-	if (tcp->u_arg[offset + 1] & O_CREAT) {
384337
+	if (tcp->u_arg[offset + 1] & (O_CREAT | STRACE_O_TMPFILE)) {
384337
 		/* mode */
384337
 		tprintf(", %#lo", tcp->u_arg[offset + 2]);
384337
 	}
384337
diff -rup a/tests/open.c b/tests/open.c
384337
--- a/tests/open.c	2017-03-27 13:09:44.078819435 -0400
384337
+++ b/tests/open.c	2017-03-27 13:31:55.843649714 -0400
384337
@@ -59,6 +59,17 @@ main(void)
384337
 		       " = %d %s (%m)\n", sample, fd, errno2name());
384337
 	}
384337
 
384337
+#ifdef O_TMPFILE
384337
+# if O_TMPFILE == (O_TMPFILE & ~O_DIRECTORY)
384337
+#  define STR_O_TMPFILE "O_TMPFILE"
384337
+# else
384337
+#  define STR_O_TMPFILE "O_DIRECTORY|O_TMPFILE"
384337
+# endif
384337
+	fd = syscall(__NR_open, sample, O_WRONLY|O_TMPFILE, 0600);
384337
+	printf("open(\"%s\", O_WRONLY|%s, 0600) = %d %s (%m)\n",
384337
+	       sample, STR_O_TMPFILE, fd, errno2name());
384337
+#endif /* O_TMPFILE */
384337
+
384337
 	puts("+++ exited with 0 +++");
384337
 	return 0;
384337
 }