|
From: <sv...@va...> - 2009-05-24 22:33:01
|
Author: njn
Date: 2009-05-24 23:32:45 +0100 (Sun, 24 May 2009)
New Revision: 10132
Log:
Trunk sync: sys_open wrapper.
Modified:
branches/DARWIN/coregrind/m_syswrap/syswrap-generic.c
Modified: branches/DARWIN/coregrind/m_syswrap/syswrap-generic.c
===================================================================
--- branches/DARWIN/coregrind/m_syswrap/syswrap-generic.c 2009-05-24 22:32:33 UTC (rev 10131)
+++ branches/DARWIN/coregrind/m_syswrap/syswrap-generic.c 2009-05-24 22:32:45 UTC (rev 10132)
@@ -3531,22 +3531,24 @@
cloned fd back to the start. */
{
HChar name[30];
+ Char* arg1s = (Char*) ARG1;
SysRes sres;
- VG_(sprintf)(name, "/proc/%d/cmdline", VG_(getpid)());
- if (ML_(safe_to_deref)( (void*)ARG1, 1 )
- && (VG_(strcmp)((Char *)ARG1, name) == 0
- || VG_(strcmp)((Char *)ARG1, "/proc/self/cmdline") == 0)) {
- sres = VG_(dup)( VG_(cl_cmdline_fd) );
- SET_STATUS_from_SysRes( sres );
- if (!sr_isError(sres)) {
- OffT off = VG_(lseek)( sr_Res(sres), 0, VKI_SEEK_SET );
- if (off < 0)
- SET_STATUS_Failure( VKI_EMFILE );
+ VG_(sprintf)(name, "/proc/%d/cmdline", VG_(getpid)());
+ if (ML_(safe_to_deref)( arg1s, 1 ) &&
+ (VG_STREQ(arg1s, name) || VG_STREQ(arg1s, "/proc/self/cmdline"))
+ )
+ {
+ sres = VG_(dup)( VG_(cl_cmdline_fd) );
+ SET_STATUS_from_SysRes( sres );
+ if (!sr_isError(sres)) {
+ OffT off = VG_(lseek)( sr_Res(sres), 0, VKI_SEEK_SET );
+ if (off < 0)
+ SET_STATUS_Failure( VKI_EMFILE );
+ }
+ return;
}
- return;
}
- }
#endif
/* Otherwise handle normally */
|