A second close(2) is used to preserve the value of errno when
reporting the error via xlog().

Signed-off-by: Chuck Lever <[email protected]>
---
 src/libjunction/junction.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libjunction/junction.c b/src/libjunction/junction.c
index 9d9a266..7b7b2e4 100644
--- a/src/libjunction/junction.c
+++ b/src/libjunction/junction.c
@@ -394,9 +394,9 @@ junction_get_mode(const char *pathname, mode_t *mode)
        if (fstat(fd, &stb) == -1) {
                xlog(D_GENERAL, "%s: failed to stat %s: %m",
                        __func__, pathname);
+               (void)close(fd);
                return FEDFS_ERR_ACCESS;
        }
-
        (void)close(fd);
 
        xlog(D_CALL, "%s: pathname %s has mode %o",


_______________________________________________
fedfs-utils-devel mailing list
[email protected]
https://oss.oracle.com/mailman/listinfo/fedfs-utils-devel

Reply via email to