diff options
author | Gerald Carter <jerry@samba.org> | 2004-07-07 19:18:31 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2004-07-07 19:18:31 +0000 |
commit | 0cf550c32aa0018ad834fc2d3cd90d9b2b146621 (patch) | |
tree | 687da224b86274ebc9c46591a812d206935c8efd /source/printing/printing.c | |
parent | 99c6d9bd34b106ae5109ffed4812b89ef0f3eaa8 (diff) | |
download | samba-0cf550c32aa0018ad834fc2d3cd90d9b2b146621.tar.gz |
r1383: sync from 3.0 tree
Diffstat (limited to 'source/printing/printing.c')
-rw-r--r-- | source/printing/printing.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/source/printing/printing.c b/source/printing/printing.c index 2274e2d5f45..8beea9d0cec 100644 --- a/source/printing/printing.c +++ b/source/printing/printing.c @@ -23,6 +23,9 @@ #include "includes.h" #include "printing.h" +extern SIG_ATOMIC_T got_sig_term; +extern SIG_ATOMIC_T reload_after_sighup; + /* Current printer interface */ static BOOL remove_from_jobs_changed(int snum, uint32 jobid); @@ -597,6 +600,7 @@ void pjob_delete(int snum, uint32 jobid) tdb_delete(pdb->tdb, print_key(jobid)); release_print_db(pdb); rap_jobid_delete(snum, jobid); + remove_from_jobs_changed( snum, jobid ); } /**************************************************************************** @@ -1195,6 +1199,22 @@ void start_background_queue(void) DEBUG(5,("start_background_queue: background LPQ thread waiting for messages\n")); while (1) { pause(); + + /* check for some essential signals first */ + + if (got_sig_term) { + exit_server("Caught TERM signal"); + } + + if (reload_after_sighup) { + change_to_root_user(); + DEBUG(1,("Reloading services after SIGHUP\n")); + reload_services(False); + reload_after_sighup = 0; + } + + /* now check for messages */ + DEBUG(10,("start_background_queue: background LPQ thread got a message\n")); message_dispatch(); } @@ -1211,9 +1231,13 @@ static void print_queue_update(int snum) * Otherwise just do the update ourselves */ - if ( background_lpq_updater_pid != -1 ) - message_send_pid(background_lpq_updater_pid, MSG_PRINTER_UPDATE, &snum, sizeof(snum), False); - else + if ( background_lpq_updater_pid != -1 ) { + become_root(); + message_send_pid(background_lpq_updater_pid, + MSG_PRINTER_UPDATE, &snum, sizeof(snum), + False); + unbecome_root(); + } else print_queue_update_internal( snum ); } |