From: Paul F. <pa...@so...> - 2025-04-17 11:01:38
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=972e1878bfa03fba4d29f8f05f1c65fbb91b8b2a commit 972e1878bfa03fba4d29f8f05f1c65fbb91b8b2a Author: Paul Floyd <pj...@wa...> Date: Thu Apr 17 13:00:04 2025 +0200 FreeBSD: changes for --modify-fds Again this is just the minumum to get the track_new test to pass. Other syscalls later. Diff: --- 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 6fd4367a83..12b18f4e6e 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 e4bb546fb4..718fa3a374 100644 --- a/none/tests/track_new.c +++ b/none/tests/track_new.c @@ -1,7 +1,4 @@ -#define _XOPEN_SOURCE 700 - #include <fcntl.h> -#include <stdio.h> #include <unistd.h> #include <sys/stat.h> @@ -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 23dec73bbc..cd443c51a9 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...) |