]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add test for correct handling of read/write with invalid fds.
authorJulian Seward <jseward@acm.org>
Thu, 23 May 2002 16:53:20 +0000 (16:53 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 23 May 2002 16:53:20 +0000 (16:53 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@315

tests/Makefile.am
tests/erringfds.c [new file with mode: 0644]

index f0c2979bf42156f98a5242b8d16fcdd0ba0e8363..14e6f25a4a38220012b48e716311604eedcfd816 100644 (file)
@@ -29,4 +29,4 @@ EXTRA_DIST = \
        pth_threadpool.c pth_specific.c pth_mutexspeed.c malloc3.c \
        pth_once.c weirdioctl.c pth_signal1.c pth_signal2.c \
        discard.c pth_semaphore1.c new_override.cpp pth_yield.c \
-       sigaltstack.c
+       sigaltstack.c erringfds.c
diff --git a/tests/erringfds.c b/tests/erringfds.c
new file mode 100644 (file)
index 0000000..0f1afe5
--- /dev/null
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+int main ( void )
+{
+  int fd, n;
+  char buf[10];
+  fd = open("foo/bar/xyzzy", O_RDONLY); /* fails */
+  printf("fd = %d\n", fd);
+  n = read ( fd, buf, 10 );
+  printf ("n = %d\n", n);
+  return 0;
+}