nfs-utils: dont leak fd in mountlist_list From: Ben Myers Don't leak this file descriptor if stat should fail. Signed-off-by: Steve Dickson --- utils/mountd/rmtab.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/utils/mountd/rmtab.c b/utils/mountd/rmtab.c index 73e917a..d86b0db 100644 --- a/utils/mountd/rmtab.c +++ b/utils/mountd/rmtab.c @@ -24,6 +24,7 @@ #include "ha-callout.h" #include /* PATH_MAX */ +#include extern int reverse_resolve; @@ -188,7 +189,9 @@ mountlist_list(void) if ((lockid = xflock(_PATH_RMTABLCK, "r")) < 0) return NULL; if (stat(_PATH_RMTAB, &stb) < 0) { - xlog(L_ERROR, "can't stat %s", _PATH_RMTAB); + xlog(L_ERROR, "can't stat %s: %s", + _PATH_RMTAB, strerror(errno)); + xfunlock(lockid); return NULL; } if (stb.st_mtime != last_mtime) {