]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
efi: add cleanup handler for closing file descriptors
authorLennart Poettering <lennart@poettering.net>
Thu, 21 Jun 2018 16:50:07 +0000 (18:50 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 16 Oct 2018 14:44:34 +0000 (16:44 +0200)
src/boot/efi/util.h

index 3e6e6102893b0952c143f41c7bdc44e5f0d57dd6..6d1a52f6188820303139accdb00112feaface1d7 100644 (file)
@@ -38,3 +38,10 @@ static inline void FreePoolp(void *p) {
 
 #define _cleanup_(x) __attribute__((cleanup(x)))
 #define _cleanup_freepool_ _cleanup_(FreePoolp)
+
+static inline void FileHandleClosep(EFI_FILE_HANDLE *handle) {
+        if (!*handle)
+                return;
+
+        uefi_call_wrapper((*handle)->Close, 1, *handle);
+}