Author: hbelusca
Date: Sat May 13 20:04:11 2017
New Revision: 74538
URL:
http://svn.reactos.org/svn/reactos?rev=74538&view=rev
Log:
Addendum to r74528 (and close the opened file handle only on success).
Modified:
branches/setup_improvements/base/setup/usetup/filesup.c
Modified: branches/setup_improvements/base/setup/usetup/filesup.c
URL:
http://svn.reactos.org/svn/reactos/branches/setup_improvements/base/setup/u…
==============================================================================
--- branches/setup_improvements/base/setup/usetup/filesup.c [iso-8859-1] (original)
+++ branches/setup_improvements/base/setup/usetup/filesup.c [iso-8859-1] Sat May 13
20:04:11 2017
@@ -105,8 +105,7 @@
HANDLE FileHandle;
NTSTATUS Status;
- RtlInitUnicodeString(&Name,
- PathName);
+ RtlInitUnicodeString(&Name, PathName);
InitializeObjectAttributes(&ObjectAttributes,
&Name,
@@ -120,14 +119,10 @@
&IoStatusBlock,
0,
FILE_SYNCHRONOUS_IO_NONALERT);
- if (!NT_SUCCESS(Status))
- {
- return FALSE;
- }
-
- NtClose(FileHandle);
-
- return TRUE;
+ if (NT_SUCCESS(Status))
+ NtClose(FileHandle);
+
+ return NT_SUCCESS(Status);
}
@@ -523,8 +518,8 @@
&IoStatusBlock,
0,
FILE_SYNCHRONOUS_IO_NONALERT);
-
- NtClose(FileHandle);
+ if (NT_SUCCESS(Status))
+ NtClose(FileHandle);
return NT_SUCCESS(Status);
}