summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2013-02-16 14:17:57 +0100
committerStefan Metzmacher <metze@samba.org>2013-02-19 15:46:45 +0100
commit1f93f0836484ccc1abe335f5bd2cfd35df0b7631 (patch)
treefe31bb8e0fc335731ca83bf664d754dd41bcb8d2 /lib
parent542400a966039178effd6c8da932ed3a8d749131 (diff)
downloadsamba-1f93f0836484ccc1abe335f5bd2cfd35df0b7631.tar.gz
samba-1f93f0836484ccc1abe335f5bd2cfd35df0b7631.tar.bz2
samba-1f93f0836484ccc1abe335f5bd2cfd35df0b7631.zip
tdb: Simplify fcntl_lock() a bit
All arguments but the cmd are the same. To me this looks a bit better and saves some bytes in the object code. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'lib')
-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)