aboutsummaryrefslogtreecommitdiffstats
path: root/connection.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-07-17 05:37:18 +0000
committerAndrew Tridgell <tridge@samba.org>1998-07-17 05:37:18 +0000
commit8d72ef6e5258fe6a3174db822e5a6b1f7a32e252 (patch)
treed942d7f9fa71305d4ba30b1283e602624c35e887 /connection.c
parentbcf5b1335d6e5183f9545eb1b23e16185264e311 (diff)
downloadandroid_external_rsync-8d72ef6e5258fe6a3174db822e5a6b1f7a32e252.tar.gz
android_external_rsync-8d72ef6e5258fe6a3174db822e5a6b1f7a32e252.tar.bz2
android_external_rsync-8d72ef6e5258fe6a3174db822e5a6b1f7a32e252.zip
use error to detect lockfile open failures vs. max connections reached
and report an appropriate error message
Diffstat (limited to 'connection.c')
-rw-r--r--connection.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/connection.c b/connection.c
index 1025c8fc..ec726075 100644
--- a/connection.c
+++ b/connection.c
@@ -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;
}