The Samba-Bugzilla – Attachment 3795 Details for
Bug 5688
LPQ process is orphaned if socket address parameter is invalid
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
LPQ process can detect parent smbd died
samba-3.2.4-smbd-orphans-lpqthread.patch (text/plain), 2.30 KB, created by
SATOH Fumiyasu
on 2008-12-09 04:11:58 UTC
(
hide
)
Description:
LPQ process can detect parent smbd died
Filename:
MIME Type:
Creator:
SATOH Fumiyasu
Created:
2008-12-09 04:11:58 UTC
Size:
2.30 KB
patch
obsolete
>This patch fixes a problem that smbd process for LPQ thread >is orphaned if the parent smbd is aborted. > >See also: https://bugzilla.samba.org/show_bug.cgi?id=5688 > >-- fumiyas, 2008-12-09 > >diff -rup samba-3.2.4/source/printing/printing.c samba-3.2.4.osstech/source/printing/printing.c >--- samba-3.2.4/source/printing/printing.c 2008-09-18 15:49:02.000000000 +0900 >+++ samba-3.2.4.osstech/source/printing/printing.c 2008-12-09 18:53:14.000000000 +0900 >@@ -1394,7 +1394,23 @@ main thread of the background lpq update > ****************************************************************************/ > void start_background_queue(void) > { >+ static int pause_pipe[2] = {-1, -1}; >+ > DEBUG(3,("start_background_queue: Starting background LPQ thread\n")); >+ >+ if (pause_pipe[0] >= 0) { >+ close(pause_pipe[0]); >+ pause_pipe[0] = -1; >+ } >+ if (pause_pipe[1] >= 0) { >+ close(pause_pipe[1]); >+ pause_pipe[1] = -1; >+ } >+ if (pipe(pause_pipe) == -1) { >+ DEBUG(5,("start_background_queue: cannot create pipe. %s\n", strerror(errno) )); >+ exit(1); >+ } >+ > background_lpq_updater_pid = sys_fork(); > > if (background_lpq_updater_pid == -1) { >@@ -1406,6 +1422,9 @@ void start_background_queue(void) > /* Child. */ > DEBUG(5,("start_background_queue: background LPQ thread started\n")); > >+ close(pause_pipe[0]); >+ pause_pipe[0] = -1; >+ > if (!reinit_after_fork(smbd_messaging_context(), true)) { > DEBUG(0,("reinit_after_fork() failed\n")); > smb_panic("reinit_after_fork() failed"); >@@ -1423,7 +1442,17 @@ void start_background_queue(void) > > DEBUG(5,("start_background_queue: background LPQ thread waiting for messages\n")); > while (1) { >- pause(); >+ fd_set pause_fds; >+ int pause_select; >+ >+ FD_ZERO(&pause_fds); >+ FD_SET(pause_pipe[1], &pause_fds); >+ pause_select = sys_select(pause_pipe[1]+1, &pause_fds, NULL, NULL, NULL); >+ /* pause_pipe[0] is closed, i.e. parent smbd and >+ children are aborted. */ >+ if (pause_select == 1) { >+ exit_server_cleanly(NULL); >+ } > > /* check for some essential signals first */ > >@@ -1449,6 +1478,9 @@ void start_background_queue(void) > 0); > } > } >+ >+ close(pause_pipe[1]); >+ pause_pipe[1] = -1; > } > > /**************************************************************************** >samba-3.2.4.osstech/source/printingã ãã«çºè¦: printing.c.old
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 5688
:
3469
| 3795