Commit 3bd834ad authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

tevc: Minor change to ipaddr code when it fails.

tevd: Proper daemonization code, controlled by debug option.
parent e91b914d
......@@ -87,7 +87,7 @@ main(int argc, char **argv)
}
if (! (he = gethostbyname(buf))) {
fatal("could not get IP address from hostname");
fatal("could not get IP address from hostname: %s", buf);
}
memcpy((char *)&myip, he->h_addr, he->h_length);
strcpy(ipbuf, inet_ntoa(myip));
......
......@@ -63,9 +63,10 @@ main(int argc, char **argv)
if (debug)
loginit(0, 0);
else
loginit(1, "tbmevd");
else {
loginit(1, "tevd");
/* See below for daemonization */
}
/*
* Set up DB state.
......@@ -105,6 +106,13 @@ main(int argc, char **argv)
if (! event_subscribe(handle, callback, tuple, "event received")) {
fatal("could not subscribe to event");
}
/*
* Do this now, once we have had a chance to fail on the above
* event system calls.
*/
if (!debug)
daemon(0, 0);
/* Begin the event loop, waiting to receive event notifications: */
event_main(handle);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment