]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fixed test to not assume that malloc(10) will return 10 nul bytes!
authorTom Hughes <tom@compton.nu>
Tue, 1 Nov 2005 17:21:03 +0000 (17:21 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 1 Nov 2005 17:21:03 +0000 (17:21 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4978

memcheck/tests/fwrite.c
memcheck/tests/fwrite.stderr.exp
memcheck/tests/fwrite.stderr.exp2
memcheck/tests/fwrite.stdout.exp [deleted file]

index 1eec4a4f8ef6872b7fc78ccc5d5ec5f04ae1fa2f..9334b2960841d12d88bb76c690f36a3307c50c19 100644 (file)
@@ -1,9 +1,17 @@
-
+#include <fcntl.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 int main ( void )
 {
    char* arr = malloc(10);
-   (void) write( 1 /* stdout */, arr, 10 );
+   int fd = open("/dev/null", O_WRONLY);
+   if (fd < 0) {
+      fprintf(stderr, "open failed\n");
+   } else {
+      (void)write(fd, arr, 10);
+      (void)close(fd);
+   }
+
    return 0;
 }
index 9286a7c17b5eba3af3be4d92117d99096938aaa8..51999cccbc65fd2cba135b61b4ac19069d60058d 100644 (file)
@@ -4,4 +4,4 @@ Syscall param write(buf) points to uninitialised byte(s)
    by 0x........: ...
  Address 0x........ is 0 bytes inside a block of size 10 alloc'd
    at 0x........: malloc (vg_replace_malloc.c:...)
-   by 0x........: main (fwrite.c:6)
+   by 0x........: main (fwrite.c:7)
index dc2027e29dc92601750d4e8ed5c8374ad28fae3e..35e92f45188e24de52a2ded67f95123d4daa0414 100644 (file)
@@ -1,6 +1,6 @@
 Syscall param write(buf) points to uninitialised byte(s)
    at 0x........: write (in /...libc...)
-   by 0x........: main (fwrite.c:7)
+   by 0x........: main (fwrite.c:12)
  Address 0x........ is 0 bytes inside a block of size 10 alloc'd
    at 0x........: malloc (vg_replace_malloc.c:...)
-   by 0x........: main (fwrite.c:6)
+   by 0x........: main (fwrite.c:7)
diff --git a/memcheck/tests/fwrite.stdout.exp b/memcheck/tests/fwrite.stdout.exp
deleted file mode 100644 (file)
index cb43b5c..0000000
Binary files a/memcheck/tests/fwrite.stdout.exp and /dev/null differ