]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
nfs-utils: dont leak fd in mountlist_list
authorBen Myers <bpm@sgi.com>
Fri, 12 Feb 2010 19:00:52 +0000 (14:00 -0500)
committerSteve Dickson <steved@redhat.com>
Fri, 12 Feb 2010 19:21:04 +0000 (14:21 -0500)
Don't leak this file descriptor if stat should fail.

Signed-off-by: Steve Dickson <steved@redhat.com>
utils/mountd/rmtab.c

index b028529f4b274e9f2fcfa5f61b70110934483680..19b22eea280d2028dd607ae5911c9687e91fc588 100644 (file)
@@ -24,6 +24,7 @@
 #include "ha-callout.h"
 
 #include <limits.h> /* PATH_MAX */
 #include "ha-callout.h"
 
 #include <limits.h> /* PATH_MAX */
+#include <errno.h>
 
 extern int reverse_resolve;
 
 
 extern int reverse_resolve;
 
@@ -187,7 +188,9 @@ mountlist_list(void)
        if ((lockid = xflock(_PATH_RMTABLCK, "r")) < 0)
                return NULL;
        if (stat(_PATH_RMTAB, &stb) < 0) {
        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) {
                return NULL;
        }
        if (stb.st_mtime != last_mtime) {