]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Yipes - my last checking borked the memcheck scalar test. This should
authorRobert Walsh <rjwalsh@valgrind.org>
Fri, 19 Nov 2004 02:11:56 +0000 (02:11 +0000)
committerRobert Walsh <rjwalsh@valgrind.org>
Fri, 19 Nov 2004 02:11:56 +0000 (02:11 +0000)
make it better.

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

coregrind/vg_syscalls.c

index 4b472032d8fa909df49dba505b18856a4dfd1332..c3701cf9f7525622d1c5e51ff4241e7a664db2ec 100644 (file)
@@ -4403,8 +4403,7 @@ POST(sys_poll)
 
 PRE(sys_readlink, Special)
 {
-   char name[25];
-
+   int saved = SYSNO;
    PRINT("sys_readlink ( %p, %p, %llu )", arg1,arg2,(ULong)arg3);
    PRE_REG_READ3(long, "readlink",
                  const char *, path, char *, buf, int, bufsiz);
@@ -4412,21 +4411,24 @@ PRE(sys_readlink, Special)
    PRE_MEM_WRITE( "readlink(buf)", arg2,arg3 );
 
    /*
-    * Handle the single case where readlink failed reading /proc/self/exe.
+    * Handle the case where readlink is looking at /proc/self/exe or
+    * /proc/<pid>/exe.
     */
 
-   VG_(sprintf)(name, "/proc/%d/exe", VG_(getpid)());
+   set_result( VG_(do_syscall)(saved, arg1, arg2, arg3));
+   if ((Int)res == -2) {
+      char name[25];
+
+      VG_(sprintf)(name, "/proc/%d/exe", VG_(getpid)());
    
-   if (VG_(strcmp)((Char *)arg1, name) == 0 ||
-      VG_(strcmp)((Char *)arg1, "/proc/self/exe") == 0) {
-      VG_(sprintf)(name, "/proc/self/fd/%d", VG_(clexecfd));
-      res = VG_(do_syscall)(SYSNO, name, arg2, arg3);
-   }
-   else {
-      res = VG_(do_syscall)(SYSNO, arg1, arg2, arg3);
+      if (VG_(strcmp)((Char *)arg1, name) == 0 ||
+          VG_(strcmp)((Char *)arg1, "/proc/self/exe") == 0) {
+         VG_(sprintf)(name, "/proc/self/fd/%d", VG_(clexecfd));
+         set_result( VG_(do_syscall)(saved, name, arg2, arg3));
+      }
    }
 
-   if (res > 0)
+   if ((Int)res > 0)
       POST_MEM_WRITE( arg2, res );
 }