]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix compiler warnings by using a variable to hide the null pointer
authorTom Hughes <tom@compton.nu>
Sat, 5 Jan 2008 00:01:20 +0000 (00:01 +0000)
committerTom Hughes <tom@compton.nu>
Sat, 5 Jan 2008 00:01:20 +0000 (00:01 +0000)
from the compiler.

Patch from Bart Van Assche <bart.vanassche@gmail.com>.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7317

memcheck/tests/execve.c
memcheck/tests/execve.stderr.exp
memcheck/tests/execve2.c
memcheck/tests/execve2.stderr.exp

index 0e8222d439a3574ab486c3a14ae00baaf4c37d07..83e058a2f33327054bbd85af3c6cccdefee7d2e4 100644 (file)
@@ -2,10 +2,11 @@
 
 int main(void)
 {
+   char* null_filename = NULL;
    char* bad[2]  = { (char*)1, NULL };
    char* good[1] = {           NULL };
 
-   execve(NULL, bad, bad);
+   execve(null_filename, bad, bad);
    execve("/bin/true", good, good);
 
    return 0;
index 9048cd7a39ce59343d76350d05812852022f062d..b8a299f61527c82722851220f68f0aef9868d451 100644 (file)
@@ -1,14 +1,14 @@
 Syscall param execve(filename) points to unaddressable byte(s)
    at 0x........: execve (in /...libc...)
-   by 0x........: main (execve.c:8)
+   by 0x........: main (execve.c:9)
  Address 0x........ is not stack'd, malloc'd or (recently) free'd
 
 Syscall param execve(argv[i]) points to unaddressable byte(s)
    at 0x........: execve (in /...libc...)
-   by 0x........: main (execve.c:8)
+   by 0x........: main (execve.c:9)
  Address 0x........ is not stack'd, malloc'd or (recently) free'd
 
 Syscall param execve(envp[i]) points to unaddressable byte(s)
    at 0x........: execve (in /...libc...)
-   by 0x........: main (execve.c:8)
+   by 0x........: main (execve.c:9)
  Address 0x........ is not stack'd, malloc'd or (recently) free'd
index 07475d38c6df9616c2ce3eebba8e0c69ab752550..b3d44ecdc20203c670251e89a2dbaede55961400 100644 (file)
@@ -3,7 +3,9 @@
 
 int main ( int argc, char** argv, char** envp )
 {
-   execve(NULL,        NULL, NULL);
+   char* null_filename = NULL;
+
+   execve(null_filename,      NULL, NULL);
    execve("../../tests/true", NULL, envp);
    assert(0);  // shouldn't get here
 }
index 9fd8ff09cb0d971c6ec9797038ef88f57e22cae3..087a1939ef19ab2445415697388dc0a77f029b5b 100644 (file)
@@ -1,4 +1,4 @@
 Syscall param execve(filename) points to unaddressable byte(s)
    at 0x........: execve (in /...libc...)
-   by 0x........: main (execve2.c:6)
+   by 0x........: main (execve2.c:8)
  Address 0x........ is not stack'd, malloc'd or (recently) free'd