On Fri, Apr 30, 2004 at 11:45:47AM +0100, Gordon Lack wrote:
> rsync doesn't actually use file-locking, so this test causes it to
> remove large-file support unnecessarily.

Rsync uses range-locking in its daemon code to implement the
"max connections" option.

> A workaround might be to build on a local file system.

I think some simple tweaking of the test function might make the test
better.  The appended C code attempts to create the lock file in /tmp
and falls back to creating the old conftest.dat if that didn't work.
If you try running this program, it should give you an exit status of
"1".

..wayne..
#define _FILE_OFFSET_BITS 64
#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/wait.h>

int main(void)
{
	struct flock lock;
        int status;
	char tpl[32] = "/tmp/locktest.XXXXXX";
	int fd = mkstemp(tpl);
	if (fd < 0) {
		strcpy(tpl, "conftest.dat");
		fd = open(tpl, O_CREAT|O_RDWR, 0600);
	}

	lock.l_type = F_WRLCK;
	lock.l_whence = SEEK_SET;
	lock.l_start = 0;
	lock.l_len = 1;
	lock.l_pid = 0;
	fcntl(fd,F_SETLK,&lock);
	if (fork() == 0) {
		lock.l_start = 1;
		_exit(fcntl(fd,F_SETLK,&lock) == 0);
        }
        wait(&status);
	unlink(tpl);
	exit(WEXITSTATUS(status));
}
-- 
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to