X-Git-Url: http://git.tuebingen.mpg.de/?p=dss.git;a=blobdiff_plain;f=dss.c;h=6f0d759db4a71084f04967f7f32aa65ea68dd394;hp=d0dab0dc3f688254163d9d138069a48dd77ccd5b;hb=6c63f45a9068107cfd80aa181134574dd9373c0b;hpb=727cf8701027f1d043f75941417dcf315ce5f875 diff --git a/dss.c b/dss.c index d0dab0d..6f0d759 100644 --- a/dss.c +++ b/dss.c @@ -1510,14 +1510,14 @@ static void lock_dss_or_die(void) static int com_run(void) { - int ret; + int ret, fd = -1; if (OPT_GIVEN(DSS, DRY_RUN)) { DSS_ERROR_LOG(("dry run not supported by this command\n")); return -E_SYNTAX; } if (OPT_GIVEN(RUN, DAEMON)) { - daemon_init(); + fd = daemon_init(); daemonized = true; logfile = open_log(OPT_STRING_VAL(RUN, LOGFILE)); } @@ -1526,6 +1526,16 @@ static int com_run(void) ret = install_sighandler(SIGHUP); if (ret < 0) return ret; + if (fd >= 0) { + ret = write(fd, "\0", 1); + if (ret != 1) { + DSS_ERROR_LOG(("write to daemon pipe returned %d\n", + ret)); + if (ret < 0) + return -ERRNO_TO_DSS_ERROR(errno); + return -E_BUG; + } + } ret = select_loop(); if (ret >= 0) /* impossible */ ret = -E_BUG;