valgrind/openat-handling.diff

66 lines
2.5 KiB
Diff

Index: include/vki-amd64-linux.h
===================================================================
--- include/vki-amd64-linux.h (revision 6565)
+++ include/vki-amd64-linux.h (working copy)
@@ -240,6 +240,8 @@ struct vki_sigcontext {
#define VKI_O_NONBLOCK 04000
#define VKI_O_LARGEFILE 0100000
+#define VKI_AT_FDCWD -100
+
#define VKI_F_DUPFD 0 /* dup */
#define VKI_F_GETFD 1 /* get close_on_exec */
#define VKI_F_SETFD 2 /* set/clear close_on_exec */
Index: include/vki-ppc32-linux.h
===================================================================
--- include/vki-ppc32-linux.h (revision 6565)
+++ include/vki-ppc32-linux.h (working copy)
@@ -300,6 +300,8 @@ struct vki_sigcontext {
#define VKI_O_NONBLOCK 04000
#define VKI_O_LARGEFILE 0200000
+#define VKI_AT_FDCWD -100
+
#define VKI_F_DUPFD 0 /* dup */
#define VKI_F_GETFD 1 /* get close_on_exec */
#define VKI_F_SETFD 2 /* set/clear close_on_exec */
Index: include/vki-x86-linux.h
===================================================================
--- include/vki-x86-linux.h (revision 6565)
+++ include/vki-x86-linux.h (working copy)
@@ -272,6 +272,8 @@ struct vki_sigcontext {
#define VKI_O_NONBLOCK 04000
#define VKI_O_LARGEFILE 0100000
+#define VKI_AT_FDCWD -100
+
#define VKI_F_DUPFD 0 /* dup */
#define VKI_F_GETFD 1 /* get close_on_exec */
#define VKI_F_SETFD 2 /* set/clear close_on_exec */
Index: include/vki-ppc64-linux.h
===================================================================
--- include/vki-ppc64-linux.h (revision 6565)
+++ include/vki-ppc64-linux.h (working copy)
@@ -357,6 +357,8 @@ struct vki_sigcontext {
#define VKI_O_NONBLOCK 04000
#define VKI_O_LARGEFILE 0200000
+#define VKI_AT_FDCWD -100
+
#define VKI_F_DUPFD 0 /* dup */
#define VKI_F_GETFD 1 /* get close_on_exec */
#define VKI_F_SETFD 2 /* set/clear close_on_exec */
Index: coregrind/m_syswrap/syswrap-linux.c
===================================================================
--- coregrind/m_syswrap/syswrap-linux.c (revision 6565)
+++ coregrind/m_syswrap/syswrap-linux.c (working copy)
@@ -2434,7 +2434,7 @@ PRE(sys_openat)
int, dfd, const char *, filename, int, flags);
}
- if (!ML_(fd_allowed)(ARG1, "openat", tid, False))
+ if (ARG1 != VKI_AT_FDCWD && !ML_(fd_allowed)(ARG1, "openat", tid, False))
SET_STATUS_Failure( VKI_EBADF );
else
PRE_MEM_RASCIIZ( "openat(filename)", ARG2 );