mirror of
https://github.com/samba-team/samba.git
synced 2025-02-04 17:47:26 +03:00
s3: Make the difference between r/o and r/w in connections_db_ctx more obvious
This commit is contained in:
parent
c571ecdfc4
commit
3deba6349c
@ -22,21 +22,16 @@
|
|||||||
static struct db_context *connections_db_ctx(bool rw)
|
static struct db_context *connections_db_ctx(bool rw)
|
||||||
{
|
{
|
||||||
static struct db_context *db_ctx;
|
static struct db_context *db_ctx;
|
||||||
|
int open_flags;
|
||||||
|
|
||||||
if (db_ctx != NULL) {
|
if (db_ctx != NULL) {
|
||||||
return db_ctx;
|
return db_ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rw) {
|
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,
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
db_ctx = db_open(NULL, lock_path("connections.tdb"), 0,
|
||||||
|
TDB_CLEAR_IF_FIRST|TDB_DEFAULT, open_flags, 0644);
|
||||||
return db_ctx;
|
return db_ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user