[PATCH 1/2] lock_reopen() in flock mode: Check return value of fstat()

Thomas Jarosch thomas.jarosch at intra2net.com
Sun Jul 19 06:04:37 EDT 2015


Port over Bron's fix from the fcntl() based lock_reopen() version.

Change introduced in

commit fdc0eb3d09bcc2ce916d2790c98839a61d403937
Author: Bron Gondwana <brong at fastmail.fm>
Date:   Tue Jun 29 13:58:51 2010 +1000

    The Rest
---
 lib/lock_flock.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/lock_flock.c b/lib/lock_flock.c
index 809cdd9..eed0dd4 100644
--- a/lib/lock_flock.c
+++ b/lib/lock_flock.c
@@ -84,8 +84,8 @@ EXPORTED int lock_reopen(int fd, const char *filename,
             return -1;
         }
 
-        fstat(fd, sbuf);
-        r = stat(filename, &sbuffile);
+        r = fstat(fd, sbuf);
+        if (!r) r = stat(filename, &sbuffile);
         if (r == -1) {
             if (failaction) *failaction = "stating";
             flock(fd, LOCK_UN);
-- 
1.9.3



More information about the Cyrus-devel mailing list