commands/localdrive/localdrive.cpp
changeset 66 2a78c4ff2eab
parent 26 5d370dafea69
--- a/commands/localdrive/localdrive.cpp	Mon Sep 20 16:46:34 2010 +0100
+++ b/commands/localdrive/localdrive.cpp	Wed Oct 13 12:41:05 2010 +0100
@@ -226,7 +226,12 @@
 	if (err == KErrNone)
 		{
 		TPckg<TLocalDriveCapsV2> capsBuf(iCaps);
-		LeaveIfErr(iDrive.Caps(capsBuf), _L("Opened drive %d but couldn't read caps"), aDrive);
+		err = iDrive.Caps(capsBuf);
+		if (err)
+			{
+			iDrive.Close();
+			if (aLeaveOnConnectErr) LeaveIfErr(err, _L("Opened drive %d but couldn't read caps"), aDrive);
+			}
 		}
 	else if (aLeaveOnConnectErr)
 		{