summaryrefslogtreecommitdiff
path: root/lib/tdb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tdb')
-rw-r--r--lib/tdb/common/lock.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/tdb/common/lock.c b/lib/tdb/common/lock.c
index dadc69e8cd..16963df097 100644
--- a/lib/tdb/common/lock.c
+++ b/lib/tdb/common/lock.c
@@ -36,6 +36,7 @@ static int fcntl_lock(struct tdb_context *tdb,
int rw, off_t off, off_t len, bool waitflag)
{
struct flock fl;
+ int cmd;
fl.l_type = rw;
fl.l_whence = SEEK_SET;
@@ -43,10 +44,9 @@ static int fcntl_lock(struct tdb_context *tdb,
fl.l_len = len;
fl.l_pid = 0;
- if (waitflag)
- return fcntl(tdb->fd, F_SETLKW, &fl);
- else
- return fcntl(tdb->fd, F_SETLK, &fl);
+ cmd = waitflag ? F_SETLKW : F_SETLK;
+
+ return fcntl(tdb->fd, cmd, &fl);
}
static int fcntl_unlock(struct tdb_context *tdb, int rw, off_t off, off_t len)