summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-06-28 23:11:31 +0000
committerJeremy Allison <jra@samba.org>2002-06-28 23:11:31 +0000
commite7a866dd3d4fc476599af0e2d5ff8889b1a7941e (patch)
tree066b1f44db68349c2fca3a66ec0760fc937db349
parentf201450f39c8a44c0da04a9289b245d5de5290c8 (diff)
downloadsamba-e7a866dd3d4fc476599af0e2d5ff8889b1a7941e.tar.gz
samba-e7a866dd3d4fc476599af0e2d5ff8889b1a7941e.tar.bz2
samba-e7a866dd3d4fc476599af0e2d5ff8889b1a7941e.zip
Shut down printing tdb correctly - this will be more important when I go
to a tdb per-queue for scalability. Jeremy. (This used to be commit e808eb2758ff4ad1eed7b50a02865b87ba0c068e)
-rw-r--r--source3/printing/printing.c20
-rw-r--r--source3/smbd/server.c1
2 files changed, 18 insertions, 3 deletions
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 6ecaf3c9bf..f8b3c9cef0 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -82,6 +82,18 @@ BOOL print_backend_init(void)
}
/****************************************************************************
+ Shut down printing backend. Called once at shutdown to close the tdb.
+****************************************************************************/
+
+void printing_end(void)
+{
+ if (tdb) {
+ tdb_close(tdb);
+ tdb = NULL;
+ }
+}
+
+/****************************************************************************
Useful function to generate a tdb key.
****************************************************************************/
@@ -253,8 +265,9 @@ static BOOL pjob_store(int jobid, struct printjob *pjob)
}
/****************************************************************************
-remove a job structure from the database
+ Remove a job structure from the database.
****************************************************************************/
+
static void pjob_delete(int jobid)
{
int snum;
@@ -486,7 +499,7 @@ static void set_updating_pid(fstring printer_name, BOOL delete)
}
/****************************************************************************
-update the internal database from the system print queue for a queue
+ Update the internal database from the system print queue for a queue.
****************************************************************************/
static void print_queue_update(int snum)
@@ -1494,7 +1507,8 @@ BOOL print_queue_resume(struct current_user *user, int snum, WERROR *errcode)
}
/* make sure the database is up to date */
- if (print_cache_expired(snum)) print_queue_update(snum);
+ if (print_cache_expired(snum))
+ print_queue_update(snum);
/* Send a printer notify message */
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 107282d36c..7d2c62d839 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -531,6 +531,7 @@ void exit_server(char *reason)
}
locking_end();
+ printing_end();
DEBUG(3,("Server exit (%s)\n", (reason ? reason : "")));
exit(0);