From 972e1878bfa03fba4d29f8f05f1c65fbb91b8b2a Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Thu, 17 Apr 2025 13:00:04 +0200 Subject: [PATCH] FreeBSD: changes for --modify-fds Again this is just the minumum to get the track_new test to pass. Other syscalls later. --- coregrind/m_syswrap/syswrap-freebsd.c | 1 + none/tests/track_new.c | 5 +---- none/tests/track_new.stderr.exp | 1 - 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index 6fd4367a8..12b18f4e6 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -5317,6 +5317,7 @@ PRE(sys_openat) POST(sys_openat) { vg_assert(SUCCESS); + POST_newFd_RES; if (!ML_(fd_allowed)(RES, "openat", tid, True)) { VG_(close)(RES); SET_STATUS_Failure( VKI_EMFILE ); diff --git a/none/tests/track_new.c b/none/tests/track_new.c index e4bb546fb..718fa3a37 100644 --- a/none/tests/track_new.c +++ b/none/tests/track_new.c @@ -1,7 +1,4 @@ -#define _XOPEN_SOURCE 700 - #include -#include #include #include @@ -15,7 +12,7 @@ main (void) /* Lets open another file... */ int newfd = open ("foobad.txt", O_RDWR|O_CREAT, S_IRUSR | S_IWUSR); /* ... oops we are using the wrong fd (but same number...) */ - dprintf (oldfd, "some new text\n"); + write(oldfd, "some new text\n", 14); close (newfd); return 0; diff --git a/none/tests/track_new.stderr.exp b/none/tests/track_new.stderr.exp index 23dec73bb..cd443c51a 100644 --- a/none/tests/track_new.stderr.exp +++ b/none/tests/track_new.stderr.exp @@ -1,6 +1,5 @@ File descriptor was closed already at 0x........: write (in /...libc...) - by 0x........: dprintf (in /...libc...) by 0x........: main Previously closed at 0x........: close (in /...libc...) -- 2.39.5