diff --git a/memcheck/tests/fwrite.c b/memcheck/tests/fwrite.c index 1eec4a4f8..9334b2960 100644 --- a/memcheck/tests/fwrite.c +++ b/memcheck/tests/fwrite.c @@ -1,9 +1,17 @@ - +#include +#include #include #include 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; } diff --git a/memcheck/tests/fwrite.stderr.exp b/memcheck/tests/fwrite.stderr.exp index 9286a7c17..51999cccb 100644 --- a/memcheck/tests/fwrite.stderr.exp +++ b/memcheck/tests/fwrite.stderr.exp @@ -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) diff --git a/memcheck/tests/fwrite.stderr.exp2 b/memcheck/tests/fwrite.stderr.exp2 index dc2027e29..35e92f451 100644 --- a/memcheck/tests/fwrite.stderr.exp2 +++ b/memcheck/tests/fwrite.stderr.exp2 @@ -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 index cb43b5ce1..000000000 Binary files a/memcheck/tests/fwrite.stdout.exp and /dev/null differ