From 904d05c3d9dec35bad0413f933ea690868a09f4f Mon Sep 17 00:00:00 2001 From: Håkon Nessjøen Date: Tue, 8 Nov 2011 23:40:06 +0100 Subject: Cleanup --- mactelnetd.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/mactelnetd.c b/mactelnetd.c index c78304b..ed9c3f9 100644 --- a/mactelnetd.c +++ b/mactelnetd.c @@ -547,7 +547,7 @@ static void handle_data_packet(struct mt_connection *curconn, struct mt_mactelne for (i = 0; i < 16; ++i) { curconn->enckey[i] = rand() % 256; } - curconn->have_enckey=1; + curconn->have_enckey = 1; memset(curconn->trypassword, 0, sizeof(curconn->trypassword)); } @@ -754,11 +754,6 @@ static void daemonize() { fd = open("/dev/null",O_RDWR); dup(fd); dup(fd); - - signal(SIGCHLD,SIG_IGN); - signal(SIGTSTP,SIG_IGN); - signal(SIGTTOU,SIG_IGN); - signal(SIGTTIN,SIG_IGN); } static void print_version() { @@ -927,13 +922,14 @@ int main (int argc, char **argv) { if (!foreground) { daemonize(); - } else { - signal(SIGCHLD,SIG_IGN); - signal(SIGTSTP,SIG_IGN); - signal(SIGTTOU,SIG_IGN); - signal(SIGTTIN,SIG_IGN); } + /* Handle zombies etc */ + signal(SIGCHLD,SIG_IGN); + signal(SIGTSTP,SIG_IGN); + signal(SIGTTOU,SIG_IGN); + signal(SIGTTIN,SIG_IGN); + openlog("mactelnetd", LOG_PID, LOG_DAEMON); syslog(LOG_NOTICE, "Bound to %s:%d", inet_ntoa(si_me.sin_addr), sourceport); -- cgit v1.2.3