[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Nbd] nbd-client zombies



Hello,

could you please add some code to nbd-client to prevent zombie processes
to show up once it is started?
The following patch fixes it for me but I do not mind calling wait() or
any other way to fix it properly (your way)... mine is just a quick
hack...

Thank you!

diff --git a/nbd-client.c b/nbd-client.c
index dadf95d..1768322 100644
--- a/nbd-client.c
+++ b/nbd-client.c
@@ -444,6 +444,7 @@ int main(int argc, char *argv[]) {
        uint32_t cflags=0;
        uint32_t opts=0;
        sigset_t block, old;
+       struct sigaction sa;
        struct option long_options[] = {
                { "block-size", required_argument, NULL, 'b' },
                { "check", required_argument, NULL, 'c' },
@@ -585,6 +586,11 @@ int main(int argc, char *argv[]) {
                if (daemon(0,0) < 0)
                        err("Cannot detach from terminal");
        }
+
+       memset(&sa, 0, sizeof(sa));
+       sa.sa_handler = SIG_IGN;
+       sigaction(SIGCHLD, &sa, NULL);
+
 #endif 
        do {
 #ifndef NOFORK

-- 
Michal Belczyk Sr.



Reply to: