summaryrefslogtreecommitdiff
path: root/source3/printing/nt_printing.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-10-31 23:41:02 +0000
committerJeremy Allison <jra@samba.org>2002-10-31 23:41:02 +0000
commit5593892caff697ffcf0db42189fd3836907e8af5 (patch)
tree7c64ee0db181ef84161db76e5342cc2652f8b66e /source3/printing/nt_printing.c
parent2d62bd52486bd20922143f61cb7a3159ec78e478 (diff)
downloadsamba-5593892caff697ffcf0db42189fd3836907e8af5.tar.gz
samba-5593892caff697ffcf0db42189fd3836907e8af5.tar.bz2
samba-5593892caff697ffcf0db42189fd3836907e8af5.zip
Fix slowdown because of enumerating all print queues on every smbd startup.
Jeremy. (This used to be commit d05b147fb3f32031a202cf61703dc2fd969f4617)
Diffstat (limited to 'source3/printing/nt_printing.c')
-rw-r--r--source3/printing/nt_printing.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 6e4bb1e977..7b19b74025 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -252,7 +252,7 @@ static BOOL upgrade_to_version_3(void)
}
/****************************************************************************
- Open the NT printing tdb.
+ Open the NT printing tdbs. Done once before fork().
****************************************************************************/
BOOL nt_printing_init(void)
@@ -263,6 +263,8 @@ BOOL nt_printing_init(void)
if (tdb_drivers && tdb_printers && tdb_forms && local_pid == sys_getpid())
return True;
+ if (tdb_drivers)
+ tdb_close(tdb_drivers);
tdb_drivers = tdb_open_log(lock_path("ntdrivers.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
if (!tdb_drivers) {
DEBUG(0,("nt_printing_init: Failed to open nt drivers database %s (%s)\n",
@@ -270,6 +272,8 @@ BOOL nt_printing_init(void)
return False;
}
+ if (tdb_printers)
+ tdb_close(tdb_printers);
tdb_printers = tdb_open_log(lock_path("ntprinters.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
if (!tdb_printers) {
DEBUG(0,("nt_printing_init: Failed to open nt printers database %s (%s)\n",
@@ -277,6 +281,8 @@ BOOL nt_printing_init(void)
return False;
}
+ if (tdb_forms)
+ tdb_close(tdb_forms);
tdb_forms = tdb_open_log(lock_path("ntforms.tdb"), 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
if (!tdb_forms) {
DEBUG(0,("nt_printing_init: Failed to open nt forms database %s (%s)\n",