From 78b1835889a5c634bb10d9328bf387c6ef5546a8 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Tue, 12 Nov 2013 18:21:54 +0000 Subject: Import VIR_FORCE_CLOSE macro from libvirt Import the macro for safely closing file descriptors Signed-off-by: Daniel P. Berrange --- libvirt-utils.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libvirt-utils.h') diff --git a/libvirt-utils.h b/libvirt-utils.h index 30380a3..795f678 100644 --- a/libvirt-utils.h +++ b/libvirt-utils.h @@ -183,4 +183,11 @@ void virFree(void *ptrptr) ATTRIBUTE_NONNULL(1); # define VIR_FREE(ptr) virFree((void *) &(ptr)) # endif +/* Don't call this directly - use the macro below */ +int virFileClose(int *fdptr) + ATTRIBUTE_RETURN_CHECK; + +# define VIR_FORCE_CLOSE(FD) \ + ignore_value(virFileClose(&(FD))) + #endif /* __LIBVIRT_UTILS_H__ */ -- cgit