Remerge fix for Bug 2109 RCL_3 PDK_3.0.i
authorWilliam Roberts <williamr@symbian.org>
Fri, 30 Apr 2010 12:43:05 +0100
branchRCL_3
changeset 21 ae47160fdc54
parent 20 a2e897c5c62b (diff)
parent 19 c39903cb48f6 (current diff)
child 26 bc49e59e6c8b
Remerge fix for Bug 2109
--- a/genericopenlibs/openenvcore/backend/src/corebackend/localif.cpp	Fri Apr 23 12:27:51 2010 +0100
+++ b/genericopenlibs/openenvcore/backend/src/corebackend/localif.cpp	Fri Apr 30 12:43:05 2010 +0100
@@ -220,6 +220,8 @@
 	RHeap* oldHeap = User::SwitchHeap(iPrivateHeap);
 	// Close the array that maintains aselect request details 
 	iASelectRequest.Close();
+	//close the RTz connection
+	iTzServer.Close();
 	// Switch back to old heap
 	User::SwitchHeap(oldHeap);
 
@@ -333,24 +335,43 @@
 
 int CLocalSystemInterface::stat (const wchar_t* name, struct stat *st, int& anErrno)
     {
-    const wchar_t* filename = name;
+    const wchar_t* filename;
+    // This needs to be zero terminated
+    TBuf<KMaxFileName> inputName;
+    TUint pathAtt = 0;
+    TInt err = GetFullFile(inputName,(const TText16*)name,iFs);
+    if( !err )
+        {
+        TInt err = iFs.Att(inputName,pathAtt);
+        if ( (err == KErrNone) && (pathAtt & KEntryAttDir) )
+            {                    
+            inputName.Append(_L("\\"));            
+            }
+        filename = (wchar_t*)inputName.PtrZ();
+        }
+    // try to stat anyway
+    else
+        {
+        inputName.Copy((const TText16*)name);
+        filename = (wchar_t*)inputName.PtrZ();
+        }
     TSpecialFileType fileType;
     struct SLinkInfo enBuf;
-    TInt err = 0;
     // Check the type of file
-    fileType = _SystemSpecialFileBasedFilePath(name, err, iFs);
+    fileType = _SystemSpecialFileBasedFilePath(filename, err, iFs);
     // If it is a symbolic link, follow the link
     // If _SystemSpecialFileBasedFilePath fails, treat it as normal file
     // and try to proceed
     if( fileType == EFileTypeSymLink && err == KErrNone )
         {
-        err = _ReadSysSplFile(name, (char*)&enBuf, sizeof(struct SLinkInfo), anErrno, iFs);
+        err = _ReadSysSplFile(filename, (char*)&enBuf, sizeof(struct SLinkInfo), anErrno, iFs);
         if (err == KErrNone)
             {
             filename = (wchar_t*)enBuf.iParentPath;
             }
         else
             {
+            // errno is already set by _ReadSysSplFile
             return -1;
             }
         }
--- a/genericopenlibs/openenvcore/libc/test/teststdlib/inc/tstdlib.h	Fri Apr 23 12:27:51 2010 +0100
+++ b/genericopenlibs/openenvcore/libc/test/teststdlib/inc/tstdlib.h	Fri Apr 30 12:43:05 2010 +0100
@@ -286,6 +286,7 @@
 _LIT(Kstrtoumaxbasic2, "strtoumaxbasic2");
 _LIT(Kconfstr_Test2, "confstr_Test2");
 _LIT(Ktmpfile_fseek, "tmpfile_fseek");
+_LIT(KtestSymLink, "testSymLink");
 
 class CTestStdlib : public CTestStep
 	{
@@ -530,6 +531,8 @@
 	TInt strtoumaxbasic2();
 	TInt confstr_Test2(  );
 	TInt tmpfile_fseek();
+	TInt testSymLink();
+	
 public:
 	TInt iParamCnt;
 	};
--- a/genericopenlibs/openenvcore/libc/test/teststdlib/scripts/tstdlib.script	Fri Apr 23 12:27:51 2010 +0100
+++ b/genericopenlibs/openenvcore/libc/test/teststdlib/scripts/tstdlib.script	Fri Apr 30 12:43:05 2010 +0100
@@ -1484,3 +1484,9 @@
 //! @SYMTestCaseID 	OPENENV-LIBC-CIT-TESTSTDLIB-0248
 RUN_TEST_STEP !Result=0 10 tstdlib confstr_Test2
 END_TESTCASE  		OPENENV-LIBC-CIT-TESTSTDLIB-0248
+
+START_TESTCASE  	OPENENV-LIBC-CIT-TESTSTDLIB-0249
+//! @SYMTestCaseID 	OPENENV-LIBC-CIT-TESTSTDLIB-0249
+RUN_TEST_STEP !Result=0 10 tstdlib testSymLink
+END_TESTCASE  		OPENENV-LIBC-CIT-TESTSTDLIB-0249
+
--- a/genericopenlibs/openenvcore/libc/test/teststdlib/src/tstdlib.cpp	Fri Apr 23 12:27:51 2010 +0100
+++ b/genericopenlibs/openenvcore/libc/test/teststdlib/src/tstdlib.cpp	Fri Apr 30 12:43:05 2010 +0100
@@ -1316,6 +1316,13 @@
    	   		err = tmpfile_fseek();
    	   		SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
    	   		}
+	
+    else if(TestStepName() == KtestSymLink)
+             {
+             INFO_PRINTF1(_L("testSymLink():"));
+             err = testSymLink();
+             SetTestStepResult(err ? static_cast<TVerdict>(err) : EPass);
+             }
    	return TestStepResult(); 
 	}
 
--- a/genericopenlibs/openenvcore/libc/test/teststdlib/src/tstdlibblocks.cpp	Fri Apr 23 12:27:51 2010 +0100
+++ b/genericopenlibs/openenvcore/libc/test/teststdlib/src/tstdlibblocks.cpp	Fri Apr 30 12:43:05 2010 +0100
@@ -8107,7 +8107,8 @@
 TInt CTestStdlib::calloc_Test4()
     {
     INFO_PRINTF1(_L("In calloc_Test4L"));
-	char  *pc = (char *)calloc(-10,10);	
+    size_t  nelem = (size_t)-10;
+	char  *pc = (char *)calloc(nelem,10);	
    
     bool i = (pc == NULL);
 	INFO_PRINTF2(_L("{Expected: 1} %d"), (int)i);
@@ -8985,3 +8986,35 @@
  		}  
  	return ret;
     }
+TInt CTestStdlib::testSymLink()
+    {
+    int ret = KErrNone;
+    const char* file = "C:\\file.dat";
+    const char* hlnk = "c:\\hard.lnk";
+    const char* hlnk2 = "c:\\\\hard.lnk";
+    
+    const char* data = "1234567890";
+    const char* data1 = "abcdefghij";
+    const char* data2 = "ABCDEFGHIJ";
+    FILE* fp = fopen(file, "w");
+    fwrite(data, 1, 10, fp);
+    fclose(fp);
+    
+    ret = link(file, hlnk);
+    if (ret)
+     {
+     printf("create hard link fail :%d\n", ret);
+     return ret;
+     }
+    
+    fp = fopen(hlnk, "r+");
+    if( fp )
+     fwrite(data1, 1, 10, fp);
+    fclose(fp);
+    
+    fp = fopen(hlnk2, "r+");
+    if( fp )
+     fwrite(data2, 1, 10, fp);
+    fclose(fp);
+    return ret;
+    }
--- a/genericopenlibs/openenvcore/libc/test/teststdlib/src/tstdlibserver.cpp	Fri Apr 23 12:27:51 2010 +0100
+++ b/genericopenlibs/openenvcore/libc/test/teststdlib/src/tstdlibserver.cpp	Fri Apr 30 12:43:05 2010 +0100
@@ -868,6 +868,10 @@
 		{
 		testStep = new CTestStdlib(aStepName);
 		}
+	if(aStepName == KtestSymLink)
+	        {
+	        testStep = new CTestStdlib(aStepName);
+	        }
 	return testStep;
 	}
 
--- a/genericservices/systemagent/src/halsettings/halfiles.cpp	Fri Apr 23 12:27:51 2010 +0100
+++ b/genericservices/systemagent/src/halsettings/halfiles.cpp	Fri Apr 30 12:43:05 2010 +0100
@@ -186,6 +186,8 @@
 		        RHandleBase handle;
 		        handle.SetHandle(pS->iValue);
 		        handle.Close();
+				// We will not persisit the closed handle
+				continue;
 		        }
 		    }
 				
--- a/lowlevellibsandfws/apputils/bsul/test/t_cacheddriveinfo/t_cacheddriveinfo.mmp	Fri Apr 23 12:27:51 2010 +0100
+++ b/lowlevellibsandfws/apputils/bsul/test/t_cacheddriveinfo/t_cacheddriveinfo.mmp	Fri Apr 30 12:43:05 2010 +0100
@@ -23,7 +23,7 @@
 CAPABILITY All -Tcb
 TARGETTYPE		EXE
 
-SYSTEMINCLUDE   /epoc32/include
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 SOURCEPATH	.
 SOURCE		t_cacheddriveinfo.cpp
--- a/lowlevellibsandfws/apputils/bsul/test/t_clientmessage/t_clientmessage.mmp	Fri Apr 23 12:27:51 2010 +0100
+++ b/lowlevellibsandfws/apputils/bsul/test/t_clientmessage/t_clientmessage.mmp	Fri Apr 30 12:43:05 2010 +0100
@@ -18,7 +18,7 @@
 CAPABILITY ReadUserData WriteUserData
 SECUREID	0x10285B57
 
-systeminclude	/epoc32/include
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 SOURCEPATH	.
 source		t_clientmessage.cpp
--- a/lowlevellibsandfws/apputils/bsul/test/t_clientmessage/t_clientmessagetestserver.mmp	Fri Apr 23 12:27:51 2010 +0100
+++ b/lowlevellibsandfws/apputils/bsul/test/t_clientmessage/t_clientmessagetestserver.mmp	Fri Apr 30 12:43:05 2010 +0100
@@ -16,7 +16,7 @@
 target		t_clientmessagetestserver.exe
 targettype	exe
 
-systeminclude	/epoc32/include
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 SOURCEPATH	.
 source		t_clientmessagetestserver.cpp
--- a/lowlevellibsandfws/apputils/bsul/test/t_iniparser/T_IniParser16.MMP	Fri Apr 23 12:27:51 2010 +0100
+++ b/lowlevellibsandfws/apputils/bsul/test/t_iniparser/T_IniParser16.MMP	Fri Apr 30 12:43:05 2010 +0100
@@ -19,7 +19,7 @@
 VENDORID 0x70000001
 
 SOURCEPATH	../t_iniparser
-systeminclude   /epoc32/include
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 source  T_IniParser16.CPP
 
--- a/lowlevellibsandfws/apputils/bsul/test/t_iniparser/T_IniParser8.MMP	Fri Apr 23 12:27:51 2010 +0100
+++ b/lowlevellibsandfws/apputils/bsul/test/t_iniparser/T_IniParser8.MMP	Fri Apr 30 12:43:05 2010 +0100
@@ -19,7 +19,7 @@
 VENDORID 0x70000001
 
 SOURCEPATH	../t_iniparser
-systeminclude   /epoc32/include
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 source  T_IniParser8.CPP
 
--- a/lowlevellibsandfws/apputils/bsul/test/t_iniparser/T_IniParserPerformance.MMP	Fri Apr 23 12:27:51 2010 +0100
+++ b/lowlevellibsandfws/apputils/bsul/test/t_iniparser/T_IniParserPerformance.MMP	Fri Apr 30 12:43:05 2010 +0100
@@ -22,7 +22,7 @@
 VENDORID 0x70000001
 
 SOURCEPATH	../t_iniparser
-systeminclude   /epoc32/include
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 userinclude ../t_iniparser
 
 source  T_IniParserPerformance.CPP
--- a/lowlevellibsandfws/apputils/bsul/test/t_iniparser/T_IniParserUnit.MMP	Fri Apr 23 12:27:51 2010 +0100
+++ b/lowlevellibsandfws/apputils/bsul/test/t_iniparser/T_IniParserUnit.MMP	Fri Apr 30 12:43:05 2010 +0100
@@ -18,7 +18,7 @@
 UID				0x10000077
 VENDORID 		0x70000001
 
-systeminclude   /epoc32/include
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 USERINCLUDE		../../src ../../inc
 
 SOURCEPATH		../t_iniparser
--- a/lowlevellibsandfws/apputils/engineering/stringpool/example/StringTableExample.mmp	Fri Apr 23 12:27:51 2010 +0100
+++ b/lowlevellibsandfws/apputils/engineering/stringpool/example/StringTableExample.mmp	Fri Apr 30 12:43:05 2010 +0100
@@ -16,7 +16,7 @@
 TARGET			StringTableExample.exe
 TARGETTYPE		exe
 
-SYSTEMINCLUDE	/epoc32/include
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 SOURCEPATH .
 SOURCE StringTableExample.cpp
--- a/lowlevellibsandfws/apputils/multipartparser/test/tef/group/mppsmoketestlib.mmp	Fri Apr 23 12:27:51 2010 +0100
+++ b/lowlevellibsandfws/apputils/multipartparser/test/tef/group/mppsmoketestlib.mmp	Fri Apr 30 12:43:05 2010 +0100
@@ -23,9 +23,7 @@
 SOURCE      mppsmoketestlib.cpp
 
 USERINCLUDE     ../smoketest/src
-SYSTEMINCLUDE   /epoc32/include
-SYSTEMINCLUDE   /epoc32/include/test
-SYSTEMINCLUDE   /epoc32/include/bafl
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 
 nostrictdef
--- a/lowlevellibsandfws/apputils/multipartparser/test/tef/group/mppsmoketesttefsuite.mmp	Fri Apr 23 12:27:51 2010 +0100
+++ b/lowlevellibsandfws/apputils/multipartparser/test/tef/group/mppsmoketesttefsuite.mmp	Fri Apr 30 12:43:05 2010 +0100
@@ -23,9 +23,7 @@
 SOURCE		mppsmoketesttefserver.cpp 
 SOURCE		mppsmoketeststeps.cpp
 
-SYSTEMINCLUDE   /epoc32/include
-SYSTEMINCLUDE	  /epoc32/include/test
-SYSTEMINCLUDE	  /epoc32/include/bafl
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 
 LIBRARY   euser.lib