> 
> @@ -402,36 +407,51 @@ static int lock_and_daemon(bool daemonize, const char 
> *base_dir)
>                       panic("fork() failed during daemonize: %m");
>                       break;
>               default:
> -                     exit(0);
> +                     ret = read(pipefd[0], &status, sizeof(status));
> +                     if (ret != sizeof(status))
> +                             panic("read exit status failed: %m");
> +
> +                     exit(status);
>                       break;
>               }
>  
> -             if (setsid() == -1)
> -                     panic("becoming a leader of a new session failed: %m");
> +             if (setsid() == -1) {
> +                     sd_eprintf("becoming a leader of a new session"
> +                             " failed: %m");
> +                     status = 1;
> +                     goto end;
> +             }
>  
>               switch (fork()) {
>               case 0:
>                       break;
>               case -1:
> -                     panic("fork() failed during daemonize: %m");
> -                     break;
> +                     sd_eprintf("fork() failed during daemonize: %m");
> +                     goto end;
>               default:

I think we need to set 'status' to 1 here.

Thanks,

Kazutaka
-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to