userlibandfileserver/fileserver/sfile/sf_file.cpp
branchRCL_3
changeset 87 2f92ad2dc5db
parent 31 56f325a607ea
child 109 b3a1d9898418
child 117 5b5d147c7838
child 132 e4a7b1cbe40c
--- a/userlibandfileserver/fileserver/sfile/sf_file.cpp	Mon Mar 15 12:45:50 2010 +0200
+++ b/userlibandfileserver/fileserver/sfile/sf_file.cpp	Wed Mar 31 23:38:45 2010 +0300
@@ -462,13 +462,24 @@
 
 	__PRINT(_L("TFsIsFileOpen::DoRequestL(CFsRequest* aRequest)"));
 	CFileCB* file;
-	TInt r=aRequest->Drive()->IsFileOpen(aRequest->Src().FullName().Mid(2),file);
-	if (r!=KErrNone)
-		return(r);
-	TBool isOpen = file?(TBool)ETrue:(TBool)EFalse;
+	TInt r = aRequest->Drive()->IsFileOpen(aRequest->Src().FullName().Mid(2), file);
+	if (r != KErrNone)
+		return (r);
+	TBool isOpen = file ? (TBool)ETrue : (TBool)EFalse;
+	if (!isOpen)
+		{
+		// perform the existance check to retain compatibility with old-style clients
+		TEntry e;
+		r = aRequest->Drive()->Entry(aRequest->Src().FullName().Mid(2), e);
+		if (r == KErrNone && e.IsDir())
+			r = KErrArgument;
+		}
+	if (r != KErrNone)
+		return (r);
+
 	TPtrC8 pA((TUint8*)&isOpen,sizeof(TBool));
 	aRequest->WriteL(KMsgPtr1,pA);
-	return(KErrNone);
+	return (KErrNone);
 	}
 
 TInt TFsIsFileOpen::Initialise(CFsRequest* aRequest)