From: Lennart Poettering Date: Thu, 21 Jun 2018 16:50:07 +0000 (+0200) Subject: efi: add cleanup handler for closing file descriptors X-Git-Tag: v240~522^2~13 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3aaa95e0a09ef1d838cc8dd8b89e7caaeba415e6;p=thirdparty%2Fsystemd.git efi: add cleanup handler for closing file descriptors --- diff --git a/src/boot/efi/util.h b/src/boot/efi/util.h index 3e6e6102893..6d1a52f6188 100644 --- a/src/boot/efi/util.h +++ b/src/boot/efi/util.h @@ -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); +}