summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2004-04-30 17:38:22 +0000
committerWayne Davison <wayned@samba.org>2004-04-30 17:38:22 +0000
commit9eac94a4ddd70b5afb37f71cc7fb36fcb46e2e44 (patch)
tree38a1d7a0c923449c3ba6ef4018976483874532d6 /configure.in
parent6e06d2f31a25c615503f4ab5903fe02d60988634 (diff)
downloadrsync-9eac94a4ddd70b5afb37f71cc7fb36fcb46e2e44.tar.gz
Improved the program that checks for broken large-file locking.
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in21
1 files changed, 13 insertions, 8 deletions
diff --git a/configure.in b/configure.in
index 245a7692..000a723a 100644
--- a/configure.in
+++ b/configure.in
@@ -146,21 +146,26 @@ AC_TRY_RUN([
int main(void)
{
struct flock lock;
- int status;
- int fd = open("conftest.dat", O_CREAT|O_RDWR, 0600);
+ 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("conftest.dat");
+ lock.l_start = 1;
+ _exit(fcntl(fd,F_SETLK,&lock) == 0);
+ }
+ wait(&status);
+ unlink(tpl);
exit(WEXITSTATUS(status));
}
],