Revision: 201012 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 27 Apr 2010 18:23:16 +0300
branchRCL_3
changeset 20 a2e897c5c62b
parent 17 ef2ebc87518f
child 21 ae47160fdc54
child 25 7701629b34a6
Revision: 201012 Kit: 201017
genericopenlibs/openenvcore/backend/src/corebackend/localif.cpp
genericopenlibs/openenvcore/libc/test/teststdlib/inc/tstdlib.h
genericopenlibs/openenvcore/libc/test/teststdlib/scripts/tstdlib.script
genericopenlibs/openenvcore/libc/test/teststdlib/src/tstdlib.cpp
genericopenlibs/openenvcore/libc/test/teststdlib/src/tstdlibblocks.cpp
genericopenlibs/openenvcore/libc/test/teststdlib/src/tstdlibserver.cpp
genericservices/systemagent/src/halsettings/halfiles.cpp
lowlevellibsandfws/apputils/bsul/test/t_cacheddriveinfo/t_cacheddriveinfo.mmp
lowlevellibsandfws/apputils/bsul/test/t_clientmessage/t_clientmessage.mmp
lowlevellibsandfws/apputils/bsul/test/t_clientmessage/t_clientmessagetestserver.mmp
lowlevellibsandfws/apputils/bsul/test/t_iniparser/T_IniParser16.MMP
lowlevellibsandfws/apputils/bsul/test/t_iniparser/T_IniParser8.MMP
lowlevellibsandfws/apputils/bsul/test/t_iniparser/T_IniParserPerformance.MMP
lowlevellibsandfws/apputils/bsul/test/t_iniparser/T_IniParserUnit.MMP
lowlevellibsandfws/apputils/engineering/stringpool/example/StringTableExample.mmp
lowlevellibsandfws/apputils/multipartparser/test/tef/group/mppsmoketestlib.mmp
lowlevellibsandfws/apputils/multipartparser/test/tef/group/mppsmoketesttefsuite.mmp
--- a/genericopenlibs/openenvcore/backend/src/corebackend/localif.cpp	Wed Apr 14 17:44:02 2010 +0300
+++ b/genericopenlibs/openenvcore/backend/src/corebackend/localif.cpp	Tue Apr 27 18:23:16 2010 +0300
@@ -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	Wed Apr 14 17:44:02 2010 +0300
+++ b/genericopenlibs/openenvcore/libc/test/teststdlib/inc/tstdlib.h	Tue Apr 27 18:23:16 2010 +0300
@@ -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	Wed Apr 14 17:44:02 2010 +0300
+++ b/genericopenlibs/openenvcore/libc/test/teststdlib/scripts/tstdlib.script	Tue Apr 27 18:23:16 2010 +0300
@@ -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	Wed Apr 14 17:44:02 2010 +0300
+++ b/genericopenlibs/openenvcore/libc/test/teststdlib/src/tstdlib.cpp	Tue Apr 27 18:23:16 2010 +0300
@@ -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	Wed Apr 14 17:44:02 2010 +0300
+++ b/genericopenlibs/openenvcore/libc/test/teststdlib/src/tstdlibblocks.cpp	Tue Apr 27 18:23:16 2010 +0300
@@ -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	Wed Apr 14 17:44:02 2010 +0300
+++ b/genericopenlibs/openenvcore/libc/test/teststdlib/src/tstdlibserver.cpp	Tue Apr 27 18:23:16 2010 +0300
@@ -868,6 +868,10 @@
 		{
 		testStep = new CTestStdlib(aStepName);
 		}
+	if(aStepName == KtestSymLink)
+	        {
+	        testStep = new CTestStdlib(aStepName);
+	        }
 	return testStep;
 	}
 
--- a/genericservices/systemagent/src/halsettings/halfiles.cpp	Wed Apr 14 17:44:02 2010 +0300
+++ b/genericservices/systemagent/src/halsettings/halfiles.cpp	Tue Apr 27 18:23:16 2010 +0300
@@ -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	Wed Apr 14 17:44:02 2010 +0300
+++ b/lowlevellibsandfws/apputils/bsul/test/t_cacheddriveinfo/t_cacheddriveinfo.mmp	Tue Apr 27 18:23:16 2010 +0300
@@ -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	Wed Apr 14 17:44:02 2010 +0300
+++ b/lowlevellibsandfws/apputils/bsul/test/t_clientmessage/t_clientmessage.mmp	Tue Apr 27 18:23:16 2010 +0300
@@ -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	Wed Apr 14 17:44:02 2010 +0300
+++ b/lowlevellibsandfws/apputils/bsul/test/t_clientmessage/t_clientmessagetestserver.mmp	Tue Apr 27 18:23:16 2010 +0300
@@ -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	Wed Apr 14 17:44:02 2010 +0300
+++ b/lowlevellibsandfws/apputils/bsul/test/t_iniparser/T_IniParser16.MMP	Tue Apr 27 18:23:16 2010 +0300
@@ -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	Wed Apr 14 17:44:02 2010 +0300
+++ b/lowlevellibsandfws/apputils/bsul/test/t_iniparser/T_IniParser8.MMP	Tue Apr 27 18:23:16 2010 +0300
@@ -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	Wed Apr 14 17:44:02 2010 +0300
+++ b/lowlevellibsandfws/apputils/bsul/test/t_iniparser/T_IniParserPerformance.MMP	Tue Apr 27 18:23:16 2010 +0300
@@ -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	Wed Apr 14 17:44:02 2010 +0300
+++ b/lowlevellibsandfws/apputils/bsul/test/t_iniparser/T_IniParserUnit.MMP	Tue Apr 27 18:23:16 2010 +0300
@@ -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	Wed Apr 14 17:44:02 2010 +0300
+++ b/lowlevellibsandfws/apputils/engineering/stringpool/example/StringTableExample.mmp	Tue Apr 27 18:23:16 2010 +0300
@@ -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	Wed Apr 14 17:44:02 2010 +0300
+++ b/lowlevellibsandfws/apputils/multipartparser/test/tef/group/mppsmoketestlib.mmp	Tue Apr 27 18:23:16 2010 +0300
@@ -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	Wed Apr 14 17:44:02 2010 +0300
+++ b/lowlevellibsandfws/apputils/multipartparser/test/tef/group/mppsmoketesttefsuite.mmp	Tue Apr 27 18:23:16 2010 +0300
@@ -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