summaryrefslogtreecommitdiff
path: root/source3/lib/conn_tdb.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-02-25 16:31:12 +0100
committerVolker Lendecke <vl@samba.org>2010-03-01 14:04:45 +0100
commit3deba6349ca751d669e2af817ec7e2c7eb6195b3 (patch)
tree42388d4d580a9418f87b742d1902a886aa3c8eac /source3/lib/conn_tdb.c
parentc571ecdfc4eae8aa4bfffefacb9eb9306cbc6389 (diff)
downloadsamba-3deba6349ca751d669e2af817ec7e2c7eb6195b3.tar.gz
samba-3deba6349ca751d669e2af817ec7e2c7eb6195b3.tar.bz2
samba-3deba6349ca751d669e2af817ec7e2c7eb6195b3.zip
s3: Make the difference between r/o and r/w in connections_db_ctx more obvious
Diffstat (limited to 'source3/lib/conn_tdb.c')
-rw-r--r--source3/lib/conn_tdb.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/source3/lib/conn_tdb.c b/source3/lib/conn_tdb.c
index 90e455a73e..e95ada4c6a 100644
--- a/source3/lib/conn_tdb.c
+++ b/source3/lib/conn_tdb.c
@@ -22,21 +22,16 @@
static struct db_context *connections_db_ctx(bool rw)
{
static struct db_context *db_ctx;
+ int open_flags;
if (db_ctx != NULL) {
return db_ctx;
}
- if (rw) {
- db_ctx = db_open(NULL, lock_path("connections.tdb"), 0,
- TDB_CLEAR_IF_FIRST|TDB_DEFAULT,
- O_RDWR | O_CREAT, 0644);
- }
- else {
- db_ctx = db_open(NULL, lock_path("connections.tdb"), 0,
- TDB_CLEAR_IF_FIRST|TDB_DEFAULT, O_RDONLY, 0);
- }
+ open_flags = rw ? (O_RDWR|O_CREAT) : O_RDONLY;
+ db_ctx = db_open(NULL, lock_path("connections.tdb"), 0,
+ TDB_CLEAR_IF_FIRST|TDB_DEFAULT, open_flags, 0644);
return db_ctx;
}