Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Renamed mkrounding.c to rounding.c.
[rsync/rsync.git]
/
connection.c
diff --git
a/connection.c
b/connection.c
index
beb1dec
..
6281861
100644
(file)
--- a/
connection.c
+++ b/
connection.c
@@
-26,19
+26,20
@@
int claim_connection(char *fname, int max_connections)
{
int fd, i;
{
int fd, i;
- if (max_connections > 0) {
- if ((fd = open(fname, O_RDWR|O_CREAT, 0600)) < 0)
- return 0;
+ if (max_connections == 0)
+ return 1;
- /* Find a free spot. */
- for (i = 0; i < max_connections; i++) {
- if (lock_range(fd, i*4, 4))
- return 1;
- }
+ if ((fd = open(fname, O_RDWR|O_CREAT, 0600)) < 0)
+ return 0;
- close(fd);
+ /* Find a free spot. */
+ for (i = 0; i < max_connections; i++) {
+ if (lock_range(fd, i*4, 4))
+ return 1;
}
}
+ close(fd);
+
/* A lock failure needs to return an errno of 0. */
errno = 0;
return 0;
/* A lock failure needs to return an errno of 0. */
errno = 0;
return 0;