summaryrefslogtreecommitdiff
path: root/source4/heimdal_build/replace.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-14 07:04:21 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:23:04 -0500
commitfa2b97a20a518708e4534e8aa2cce12024228488 (patch)
treeb3e803a401b64db1b5b425309ebeb31198036fd7 /source4/heimdal_build/replace.c
parentaf0574378b3e73ffe637618e2f504d58735d6543 (diff)
downloadsamba-fa2b97a20a518708e4534e8aa2cce12024228488.tar.gz
samba-fa2b97a20a518708e4534e8aa2cce12024228488.tar.bz2
samba-fa2b97a20a518708e4534e8aa2cce12024228488.zip
r8451: samba4 finally builds on solaris 8 sparc with heimdal and ejs
its been a long haul ... (This used to be commit 3c4291e49abed14973b4a4fa1a9277918b896cac)
Diffstat (limited to 'source4/heimdal_build/replace.c')
-rw-r--r--source4/heimdal_build/replace.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/source4/heimdal_build/replace.c b/source4/heimdal_build/replace.c
index 46019d7bb5..f222e764e4 100644
--- a/source4/heimdal_build/replace.c
+++ b/source4/heimdal_build/replace.c
@@ -23,6 +23,8 @@
#include "config.h"
#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
#include "err.h"
#include "roken.h"
@@ -62,15 +64,22 @@
#ifndef HAVE_FLOCK
int flock(int fd, int op)
{
+ struct flock lock;
+ lock.l_whence = 0;
+ lock.l_start = 0;
+ lock.l_len = 0;
+ lock.l_pid = 0;
+
switch (op & (LOCK_UN|LOCK_SH|LOCK_EX)) {
case LOCK_UN:
- return fcntl_lock(fd, F_SETLK, 0, 0, F_UNLCK);
+ lock.l_type = F_UNLCK;
+ return fcntl(fd, F_SETLK, &lock);
case LOCK_SH:
- return fcntl_lock(fd, (op&LOCK_NB)?F_SETLK:F_SETLKW,
- 0, 0, F_RDLCK);
+ lock.l_type = F_RDLCK;
+ return fcntl(fd, (op&LOCK_NB)?F_SETLK:F_SETLKW, &lock);
case LOCK_EX:
- return fcntl_lock(fd, (op&LOCK_NB)?F_SETLK:F_SETLKW,
- 0, 0, F_WRLCK);
+ lock.l_type = F_WRLCK;
+ return fcntl(fd, (op&LOCK_NB)?F_SETLK:F_SETLKW, &lock);
}
errno = EINVAL;
return -1;