Files
valgrind/none/tests/track_new.c
Paul Floyd 972e1878bf FreeBSD: changes for --modify-fds
Again this is just the minumum to get the track_new test to pass.
Other syscalls later.
2025-04-17 13:00:04 +02:00

20 lines
445 B
C

#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
int
main (void)
{
int oldfd = open ("foobar.txt", O_RDWR|O_CREAT, S_IRUSR | S_IWUSR);
/*... do something with oldfd ...*/
close (oldfd);
/* 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...) */
write(oldfd, "some new text\n", 14);
close (newfd);
return 0;
}