|
From: <sv...@va...> - 2007-01-13 22:28:13
|
Author: sewardj
Date: 2007-01-13 22:27:51 +0000 (Sat, 13 Jan 2007)
New Revision: 6519
Log:
When '-d' (one or more) is specified, disallow the client from closing
fd 2 (stderr) since that's what m_debuglog writes to, and the
resulting disappearance of the debug log can be confusing.
Modified:
trunk/coregrind/m_syswrap/syswrap-aix5.c
trunk/coregrind/m_syswrap/syswrap-generic.c
Modified: trunk/coregrind/m_syswrap/syswrap-aix5.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-aix5.c 2007-01-13 06:54:57 UTC (rev=
6518)
+++ trunk/coregrind/m_syswrap/syswrap-aix5.c 2007-01-13 22:27:51 UTC (rev=
6519)
@@ -764,6 +764,10 @@
{
PRINT("close ( %ld )", ARG1);
PRE_REG_READ1(void, "close", UInt, fd);
+ /* If doing -d style logging (which is to fd=3D2), don't allow that
+ to be closed. */
+ if (ARG1 =3D=3D 2/*stderr*/ && VG_(debugLog_getLevel)() > 0)
+ SET_STATUS_Failure( VKI_EBADF );
}
=20
PRE(sys_connext)
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 2007-01-13 06:54:57 UTC (=
rev 6518)
+++ trunk/coregrind/m_syswrap/syswrap-generic.c 2007-01-13 22:27:51 UTC (=
rev 6519)
@@ -2668,7 +2668,10 @@
PRE_REG_READ1(long, "close", unsigned int, fd);
=20
/* Detect and negate attempts by the client to close Valgrind's log f=
d */
- if (!ML_(fd_allowed)(ARG1, "close", tid, False))
+ if ( (!ML_(fd_allowed)(ARG1, "close", tid, False))
+ /* If doing -d style logging (which is to fd=3D2), don't
+ allow that to be closed either. */
+ || (ARG1 =3D=3D 2/*stderr*/ && VG_(debugLog_getLevel)() > 0) )
SET_STATUS_Failure( VKI_EBADF );
}
=20
|