|
From: <sv...@va...> - 2005-09-30 01:09:53
|
Author: sewardj
Date: 2005-09-30 02:09:50 +0100 (Fri, 30 Sep 2005)
New Revision: 4828
Log:
In PRE(sys_readlink), fix up handling of /proc/<pid>/exe and
/proc/self/exe.
Modified:
trunk/coregrind/m_syswrap/syswrap-generic.c
Modified: trunk/coregrind/m_syswrap/syswrap-generic.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_syswrap/syswrap-generic.c 2005-09-30 01:07:14 UTC (=
rev 4827)
+++ trunk/coregrind/m_syswrap/syswrap-generic.c 2005-09-30 01:09:50 UTC (=
rev 4828)
@@ -4625,7 +4625,9 @@
=20
PRE(sys_readlink)
{
- Word saved =3D SYSNO;
+ HChar name[25];
+ Word saved =3D SYSNO;
+
PRINT("sys_readlink ( %p, %p, %llu )", ARG1,ARG2,(ULong)ARG3);
PRE_REG_READ3(long, "readlink",
const char *, path, char *, buf, int, bufsiz);
@@ -4636,20 +4638,15 @@
* Handle the case where readlink is looking at /proc/self/exe or
* /proc/<pid>/exe.
*/
-
- SET_STATUS_from_SysRes( VG_(do_syscall3)(saved, ARG1, ARG2, ARG3));
-
- /* jrs 20050604: where does the magic value 2 come from? It seems
- like it should be a kernel error value, but we don't know of any
- such. */
- if (SWHAT =3D=3D SsFailure && RES_unchecked =3D=3D 2) {
- HChar name[25];
- VG_(sprintf)(name, "/proc/%d/exe", VG_(getpid)());
- if (VG_(strcmp)((Char *)ARG1, name) =3D=3D 0 ||
- VG_(strcmp)((Char *)ARG1, "/proc/self/exe") =3D=3D 0) {
- VG_(sprintf)(name, "/proc/self/fd/%d", VG_(cl_exec_fd));
- SET_STATUS_from_SysRes( VG_(do_syscall3)(saved, (UWord)name, AR=
G2, ARG3));
- }
+ VG_(sprintf)(name, "/proc/%d/exe", VG_(getpid)());
+ if (VG_(strcmp)((Char *)ARG1, name) =3D=3D 0=20
+ || VG_(strcmp)((Char *)ARG1, "/proc/self/exe") =3D=3D 0) {
+ VG_(sprintf)(name, "/proc/self/fd/%d", VG_(cl_exec_fd));
+ SET_STATUS_from_SysRes( VG_(do_syscall3)(saved, (UWord)name,=20
+ ARG2, ARG3));
+ } else {
+ /* Normal case */
+ SET_STATUS_from_SysRes( VG_(do_syscall3)(saved, ARG1, ARG2, ARG3))=
;
}
=20
if (SUCCESS && RES > 0)
|