diff options
Diffstat (limited to 'libvirt-utils.c')
-rw-r--r-- | libvirt-utils.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libvirt-utils.c b/libvirt-utils.c index 873552c..6866bf1 100644 --- a/libvirt-utils.c +++ b/libvirt-utils.c @@ -115,3 +115,22 @@ void virFree(void *ptrptr) *(void**)ptrptr = NULL; errno = save_errno; } + + +int virFileClose(int *fdptr) +{ + int saved_errno = 0; + int rc = 0; + + saved_errno = errno; + + if (*fdptr < 0) + return 0; + + rc = close(*fdptr); + *fdptr = -1; + + errno = saved_errno; + + return rc; +} |