At Thu, 09 May 2013 01:18:44 +0900, MORITA Kazutaka wrote: > > At Tue, 7 May 2013 01:15:41 +0900, > Hitoshi Mitake wrote: > > > > Currently, lock_and_daemon() always returns 0 as its exit > > status. But this behavior is confusing because users cannot detect > > errors during locking a base directory via the exit status. This patch > > modifies lock_and_daemon() for returning correct exit status. > > > > Signed-off-by: Hitoshi Mitake <[email protected]> > > --- > > sheep/sheep.c | 49 +++++++++++++++++++++++++++++++++++++------------ > > 1 files changed, 37 insertions(+), 12 deletions(-) > > > > diff --git a/sheep/sheep.c b/sheep/sheep.c > > index a7e3820..64f04ca 100644 > > --- a/sheep/sheep.c > > +++ b/sheep/sheep.c > > @@ -392,7 +392,12 @@ static void check_host_env(void) > > > > static int lock_and_daemon(bool daemonize, const char *base_dir) > > { > > - int ret, devnull_fd = 0; > > + int ret, devnull_fd = 0, status = 0; > > + int pipefd[2]; > > + > > + ret = pipe(pipefd); > > + if (ret < 0) > > + panic("pipe() for passing exit status failed: %m"); > > Can we use eventfd instead of pipe?
OK, eventfd is more simple. I agree with using it. I'll send v2 later. Thanks, Hitoshi -- sheepdog mailing list [email protected] http://lists.wpkg.org/mailman/listinfo/sheepdog
