diff options
author | Andrew Tridgell <tridge@samba.org> | 2000-10-10 06:45:09 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2000-10-10 06:45:09 +0000 |
commit | 2d33e87424197b993e8e7d218c0945cc2b66078a (patch) | |
tree | ec4eeb9c527acd59c9dfdc72cb6be03a5a361540 /source3/printing/nt_printing.c | |
parent | 2a9ce69f3b4a020bd1442901625562c6391746cd (diff) | |
download | samba-2d33e87424197b993e8e7d218c0945cc2b66078a.tar.gz samba-2d33e87424197b993e8e7d218c0945cc2b66078a.tar.bz2 samba-2d33e87424197b993e8e7d218c0945cc2b66078a.zip |
got rid of tdb_writelock() and instead lock a chain. tdb_writelock()
is conceptually flawed
(This used to be commit 6e4a3585521b7e5928298bd0f1418ff9fbcacfb4)
Diffstat (limited to 'source3/printing/nt_printing.c')
-rw-r--r-- | source3/printing/nt_printing.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 69e9233d27..bd968c66ab 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -50,6 +50,7 @@ open the NT printing tdb BOOL nt_printing_init(void) { static pid_t local_pid; + char *vstring = "INFO/version"; if (tdb && local_pid == sys_getpid()) return True; tdb = tdb_open(lock_path("ntdrivers.tdb"), 0, 0, O_RDWR|O_CREAT, 0600); @@ -61,12 +62,12 @@ BOOL nt_printing_init(void) local_pid = sys_getpid(); /* handle a Samba upgrade */ - tdb_writelock(tdb); - if (tdb_fetch_int(tdb, "INFO/version") != DATABASE_VERSION) { + tdb_lock_bystring(tdb, vstring); + if (tdb_fetch_int(tdb, vstring) != DATABASE_VERSION) { tdb_traverse(tdb, (tdb_traverse_func)tdb_delete, NULL); - tdb_store_int(tdb, "INFO/version", DATABASE_VERSION); + tdb_store_int(tdb, vstring, DATABASE_VERSION); } - tdb_writeunlock(tdb); + tdb_unlock_bystring(tdb, vstring); return True; } |