use error to detect lockfile open failures vs. max connections reached
[rsync/rsync.git] / connection.c
index 1025c8f..ec72607 100644 (file)
@@ -29,7 +29,7 @@ int claim_connection(char *fname,int max_connections)
 
        if (max_connections <= 0)
                return 1;
-       
+
        fd = open(fname,O_RDWR|O_CREAT, 0600);
 
        if (fd == -1) {
@@ -41,6 +41,9 @@ int claim_connection(char *fname,int max_connections)
                if (lock_range(fd, i*4, 4)) return 1;
        }               
 
+       /* only interested in open failures */
+       errno = 0;
+
        close(fd);
        return 0;
 }