Changed signal handlers

This commit is contained in:
Michiel Broek 2003-10-13 21:36:30 +00:00
parent 15067205a8
commit 933b73246f
6 changed files with 262 additions and 244 deletions

View File

@ -24,6 +24,7 @@ v0.39.0 09-Oct-2003
Shakhaylo. This is experimental and looks compatible with Shakhaylo. This is experimental and looks compatible with
mailers that don't support this option. The compression will mailers that don't support this option. The compression will
transfer some files about twice as fast as without compression. transfer some files about twice as fast as without compression.
Changed signal handlers to better detect broken TCP links.
lang: lang:
Added language prompt 20. Added language prompt 20.

View File

@ -106,7 +106,7 @@ dietifna.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/no
emsidat.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/dbnode.h emsi.h session.h lutil.h config.h emsidat.h filetime.h emsidat.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/dbnode.h emsi.h session.h lutil.h config.h emsidat.h filetime.h
filelist.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/nodelist.h config.h session.h filelist.h filelist.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/nodelist.h config.h session.h filelist.h
openfile.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/clcomm.h ../lib/common.h ../lib/users.h ../lib/records.h config.h lutil.h openfile.h openfile.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/clcomm.h ../lib/common.h ../lib/users.h ../lib/records.h config.h lutil.h openfile.h
openport.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ulock.h ttyio.h openport.h openport.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h ulock.h ttyio.h mbcico.h openport.h
opentcp.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/dbnode.h session.h ttyio.h openport.h opentcp.h opentcp.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/dbnode.h session.h ttyio.h openport.h opentcp.h
rdoptions.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/dbnode.h session.h config.h rdoptions.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/nodelist.h ../lib/dbnode.h session.h config.h
yoohoo.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/nodelist.h ../lib/dbnode.h ../lib/mberrors.h statetbl.h ttyio.h session.h config.h emsi.h hydra.h rdoptions.h wazoo.h dietifna.h yoohoo.h inbound.h yoohoo.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/nodelist.h ../lib/dbnode.h ../lib/mberrors.h statetbl.h ttyio.h session.h config.h emsi.h hydra.h rdoptions.h wazoo.h dietifna.h yoohoo.h inbound.h

View File

@ -189,13 +189,13 @@ int main(int argc, char *argv[])
Syslog(' ', "MBCICO v%s", VERSION); Syslog(' ', "MBCICO v%s", VERSION);
/* /*
* Catch all signals we can, and handle the rest. * Catch all signals we can, and ignore the rest.
*/ */
for (i = 0; i < NSIG; i++) { for (i = 0; i < NSIG; i++) {
if ((i == SIGINT) || (i == SIGBUS) || (i == SIGFPE) || (i == SIGSEGV)) { if ((i == SIGINT) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM) || (i == SIGKILL)) {
signal(i, (void (*))die); signal(i, (void (*))die);
} else { } else {
signal(i, SIG_DFL); signal(i, SIG_IGN);
} }
} }

View File

@ -1,11 +1,11 @@
/***************************************************************************** /*****************************************************************************
* *
* $Id$
* File ..................: mbcico/openport.c * File ..................: mbcico/openport.c
* Purpose ...............: Fidonet mailer * Purpose ...............: Fidonet mailer
* Last modification date : 07-Aug-2001
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2001 * Copyright (C) 1997-2003
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -36,6 +36,7 @@
#include "../lib/clcomm.h" #include "../lib/clcomm.h"
#include "ulock.h" #include "ulock.h"
#include "ttyio.h" #include "ttyio.h"
#include "mbcico.h"
#include "openport.h" #include "openport.h"
@ -49,142 +50,140 @@ int hanged_up = 0;
void linedrop(int sig) void linedrop(int sig)
{ {
Syslog('+', "openport: Lost Carrier"); Syslog('+', "openport: Lost Carrier");
hanged_up=1; hanged_up=1;
return; return;
} }
void sigpipe(int sig) void sigpipe(int sig)
{ {
Syslog('+', "openport: Got SIGPIPE"); Syslog('+', "openport: Got SIGPIPE");
hanged_up=1; hanged_up=1;
return; return;
} }
void interrupt(int sig) void interrupt(int sig)
{ {
Syslog('+', "openport: Got SIGINT"); Syslog('+', "openport: Got SIGINT");
signal(SIGINT,interrupt); signal(SIGINT,interrupt);
return; return;
} }
int openport(char *port, int speed) int openport(char *port, int speed)
{ {
int rc, rc2; int rc, rc2, fd, outflags;
char *errtty=NULL; char *errtty=NULL;
int fd;
int outflags;
Syslog('t', "Try opening port \"%s\" at %d",MBSE_SS(port),speed); Syslog('t', "Try opening port \"%s\" at %d",MBSE_SS(port),speed);
if (openedport) if (openedport)
free(openedport); free(openedport);
openedport = NULL;
if (port[0] == '/')
openedport = xstrcpy(port);
else {
openedport = xstrcpy((char *)"/dev/");
openedport = xstrcat(openedport, port);
}
pname = strrchr(openedport, '/');
if ((rc = lock(pname))) {
Syslog('+', "Port %s is locked (rc = %d)", port, rc);
free(openedport);
openedport = NULL; openedport = NULL;
if (port[0] == '/')
openedport = xstrcpy(port);
else {
openedport = xstrcpy((char *)"/dev/");
openedport = xstrcat(openedport, port);
}
pname = strrchr(openedport, '/');
if ((rc = lock(pname))) {
Syslog('+', "Port %s is locked (rc = %d)", port, rc);
free(openedport);
openedport = NULL;
return rc;
}
if (need_detach) {
fflush(stdin);
fflush(stdout);
setbuf(stdin, NULL);
setbuf(stdout, NULL);
close(0);
close(1);
/*
* If we were manual started the error tty must be closed.
*/
if ((errtty = ttyname(2))) {
Syslog('t', "openport: stderr was on \"%s\", closing",errtty);
fflush(stderr);
close(2);
}
}
tty_status = 0;
hanged_up = 0;
signal(SIGHUP, linedrop);
signal(SIGPIPE, sigpipe);
signal(SIGINT, interrupt);
rc = 0;
rc2 = 0;
Syslog('T', "Try open %s", MBSE_SS(openedport));
if ((fd = open(openedport,O_RDONLY|O_NONBLOCK)) != 0) {
rc = 1;
Syslog('+', "$Cannot open \"%s\" as stdin",MBSE_SS(openedport));
fd = open("/dev/null",O_RDONLY);
}
if ((fd = open(openedport,O_WRONLY|O_NONBLOCK)) != 1) {
rc = 1;
Syslog('+', "$Cannot open \"%s\" as stdout",MBSE_SS(openedport));
fd = open("/dev/null",O_WRONLY);
}
clearerr(stdin);
clearerr(stdout);
if (need_detach) {
#ifdef TIOCSCTTY
if ((rc2 = ioctl(0,TIOCSCTTY,1L)) < 0) {
Syslog('t', "$TIOCSCTTY failed rc = %d", rc2);
}
#endif
if (errtty) {
rc = rc || (open(errtty,O_WRONLY) != 2);
}
need_detach=0;
}
Syslog('T', "after open rc=%d",rc);
if (rc)
Syslog('+', "cannot switch i/o to port \"%s\"",MBSE_SS(openedport));
else {
if (tty_raw(speed)) {
WriteError("$cannot set raw mode for \"%s\"",MBSE_SS(openedport));
rc=1;
}
if (((f_flags = fcntl(0, F_GETFL, 0L)) == -1) || ((outflags = fcntl(1, F_GETFL, 0L)) == -1)) {
rc = 1;
WriteError("$GETFL error");
f_flags = 0;
outflags = 0;
} else {
Syslog('t', "Return to blocking mode");
f_flags &= ~O_NONBLOCK;
outflags &= ~O_NONBLOCK;
if ((fcntl(0, F_SETFL, f_flags) != 0) || (fcntl(1, F_SETFL, outflags) != 0)) {
rc = 1;
WriteError("$SETFL error");
}
}
Syslog('T', "File flags: stdin: 0x%04x, stdout: 0x%04x", f_flags,outflags);
}
if (rc)
closeport();
else
SetTTY(port);
return rc; return rc;
}
if (need_detach) {
fflush(stdin);
fflush(stdout);
setbuf(stdin, NULL);
setbuf(stdout, NULL);
close(0);
close(1);
/*
* If we were manual started the error tty must be closed.
*/
if ((errtty = ttyname(2))) {
Syslog('t', "openport: stderr was on \"%s\", closing",errtty);
fflush(stderr);
close(2);
}
}
tty_status = 0;
hanged_up = 0;
Syslog('t', "SIGHUP => linedrop()");
signal(SIGHUP, linedrop);
Syslog('t', "SIGPIPE => sigpipe()");
signal(SIGPIPE, sigpipe);
Syslog('t', "SIGINT => interrupt()");
signal(SIGINT, interrupt);
rc = 0;
rc2 = 0;
if ((fd = open(openedport,O_RDONLY|O_NONBLOCK)) != 0) {
rc = 1;
Syslog('+', "$Cannot open \"%s\" as stdin",MBSE_SS(openedport));
fd = open("/dev/null",O_RDONLY);
}
if ((fd = open(openedport,O_WRONLY|O_NONBLOCK)) != 1) {
rc = 1;
Syslog('+', "$Cannot open \"%s\" as stdout",MBSE_SS(openedport));
fd = open("/dev/null",O_WRONLY);
}
clearerr(stdin);
clearerr(stdout);
if (need_detach) {
#ifdef TIOCSCTTY
if ((rc2 = ioctl(0,TIOCSCTTY,1L)) < 0) {
Syslog('t', "$TIOCSCTTY failed rc = %d", rc2);
}
#endif
if (errtty) {
rc = rc || (open(errtty,O_WRONLY) != 2);
}
need_detach=0;
}
if (rc)
Syslog('+', "cannot switch i/o to port \"%s\"",MBSE_SS(openedport));
else {
if (tty_raw(speed)) {
WriteError("$cannot set raw mode for \"%s\"",MBSE_SS(openedport));
rc=1;
}
if (((f_flags = fcntl(0, F_GETFL, 0L)) == -1) || ((outflags = fcntl(1, F_GETFL, 0L)) == -1)) {
rc = 1;
WriteError("$GETFL error");
f_flags = 0;
outflags = 0;
} else {
Syslog('t', "Return to blocking mode");
f_flags &= ~O_NONBLOCK;
outflags &= ~O_NONBLOCK;
if ((fcntl(0, F_SETFL, f_flags) != 0) || (fcntl(1, F_SETFL, outflags) != 0)) {
rc = 1;
WriteError("$SETFL error");
}
}
Syslog('t', "File flags: stdin: 0x%04x, stdout: 0x%04x", f_flags,outflags);
}
if (rc)
closeport();
else
SetTTY(port);
return rc;
} }
@ -194,77 +193,87 @@ int openport(char *port, int speed)
*/ */
void localport(void) void localport(void)
{ {
Syslog('t', "Setting port \"%s\" local",MBSE_SS(openedport)); Syslog('t', "Setting port \"%s\" local",MBSE_SS(openedport));
signal(SIGHUP,SIG_IGN); Syslog('t', "SIGHUP => SIG_IGN");
signal(SIGPIPE,SIG_IGN); signal(SIGHUP, SIG_IGN);
if (isatty(0)) Syslog('t', "SIGPIPE => SIG_IGN");
tty_local(); signal(SIGPIPE, SIG_IGN);
return;
if (isatty(0))
tty_local();
return;
} }
void nolocalport(void) void nolocalport(void)
{ {
Syslog('t', "Setting port \"%s\" non-local",MBSE_SS(openedport)); Syslog('t', "Setting port \"%s\" non-local",MBSE_SS(openedport));
if (isatty(0)) if (isatty(0))
tty_nolocal(); tty_nolocal();
return;
return;
} }
int rawport(void) int rawport(void)
{ {
tty_status = 0; tty_status = 0;
signal(SIGHUP,linedrop); Syslog('t', "SIGHUP => linedrop()");
signal(SIGPIPE,sigpipe); signal(SIGHUP, linedrop);
Syslog('t', "SIGPIPE => sigpipe()");
signal(SIGPIPE, sigpipe);
if (isatty(0)) if (isatty(0))
return tty_raw(0); return tty_raw(0);
else else
return 0; return 0;
} }
int cookedport(void) int cookedport(void)
{ {
signal(SIGHUP,SIG_IGN); Syslog('t', "SIGHUP => SIG_IGN");
signal(SIGPIPE,SIG_IGN); signal(SIGHUP, SIG_IGN);
if (isatty(0)) Syslog('t', "SIGHUP => SIG_IGN");
return tty_cooked(); signal(SIGPIPE, SIG_IGN);
else if (isatty(0))
return 0; return tty_cooked();
else
return 0;
} }
void closeport(void) void closeport(void)
{ {
if (openedport == NULL) if (openedport == NULL)
return;
Syslog('t', "Closing port \"%s\"",MBSE_SS(openedport));
fflush(stdin);
fflush(stdout);
tty_cooked();
close(0);
close(1);
ulock(pname);
if (openedport)
free(openedport);
openedport = NULL;
SetTTY((char *)"-");
return; return;
Syslog('t', "Closing port \"%s\"",MBSE_SS(openedport));
fflush(stdin);
fflush(stdout);
tty_cooked();
close(0);
close(1);
ulock(pname);
if (openedport)
free(openedport);
openedport = NULL;
SetTTY((char *)"-");
return;
} }
void sendbrk(void) void sendbrk(void)
{ {
Syslog('t', "Send break"); Syslog('t', "Send break");
if (isatty(0))
if (isatty(0)) {
#if (defined(TIOCSBRK)) #if (defined(TIOCSBRK))
Syslog('t', "TIOCSBRK"); Syslog('t', "TIOCSBRK");
ioctl(0, TIOCSBRK, 0L); ioctl(0, TIOCSBRK, 0L);
@ -274,6 +283,7 @@ void sendbrk(void)
#else /* any ideas about BSD? */ #else /* any ideas about BSD? */
; ;
#endif #endif
}
} }
@ -389,119 +399,118 @@ static struct termios tios;
int tty_raw(int speed) int tty_raw(int speed)
{ {
int rc; int rc;
speed_t tspeed, is, os; speed_t tspeed, is, os;
Syslog('t', "Set tty raw"); Syslog('t', "Set tty raw");
tspeed = transpeed(speed); tspeed = transpeed(speed);
if ((rc = tcgetattr(0,&savetios))) {
WriteError("$tcgetattr(0,save) return %d",rc);
return rc;
} else {
Syslog('T', "savetios.c_iflag=0x%08x",savetios.c_iflag);
Syslog('T', "savetios.c_oflag=0x%08x",savetios.c_oflag);
Syslog('T', "savetios.c_cflag=0x%08x",savetios.c_cflag);
Syslog('T', "savetios.c_lflag=0x%08x",savetios.c_lflag);
Syslog('T', "savetios.c_cc=\"%s\"",printable(savetios.c_cc,NCCS));
Syslog('T', "file flags: stdin: 0x%04x, stdout: 0x%04x", fcntl(0,F_GETFL,0L),fcntl(1,F_GETFL,0L));
}
tios = savetios;
tios.c_iflag = 0;
tios.c_oflag = 0;
tios.c_cflag &= ~(CSTOPB | PARENB | PARODD);
tios.c_cflag |= CS8 | CREAD | HUPCL | CLOCAL;
tios.c_lflag = 0;
tios.c_cc[VMIN] = 1;
tios.c_cc[VTIME] = 0;
if (tspeed) {
cfsetispeed(&tios,tspeed);
cfsetospeed(&tios,tspeed);
}
if ((rc = tcsetattr(0,TCSADRAIN,&tios)))
WriteError("$tcsetattr(0,TCSADRAIN,raw) return %d",rc);
is = cfgetispeed(&tios);
os = cfgetospeed(&tios);
if ((rc = tcgetattr(0,&savetios))) {
WriteError("$tcgetattr(0,save) return %d",rc);
return rc; return rc;
} else {
Syslog('T', "savetios.c_iflag=0x%08x",savetios.c_iflag);
Syslog('T', "savetios.c_oflag=0x%08x",savetios.c_oflag);
Syslog('T', "savetios.c_cflag=0x%08x",savetios.c_cflag);
Syslog('T', "savetios.c_lflag=0x%08x",savetios.c_lflag);
Syslog('T', "savetios.c_cc=\"%s\"",printable(savetios.c_cc,NCCS));
Syslog('T', "file flags: stdin: 0x%04x, stdout: 0x%04x", fcntl(0,F_GETFL,0L),fcntl(1,F_GETFL,0L));
}
tios = savetios;
tios.c_iflag = 0;
tios.c_oflag = 0;
tios.c_cflag &= ~(CSTOPB | PARENB | PARODD);
tios.c_cflag |= CS8 | CREAD | HUPCL | CLOCAL;
tios.c_lflag = 0;
tios.c_cc[VMIN] = 1;
tios.c_cc[VTIME] = 0;
if (tspeed) {
cfsetispeed(&tios,tspeed);
cfsetospeed(&tios,tspeed);
}
if ((rc = tcsetattr(0,TCSADRAIN,&tios)))
WriteError("$tcsetattr(0,TCSADRAIN,raw) return %d",rc);
is = cfgetispeed(&tios);
os = cfgetospeed(&tios);
return rc;
} }
int tty_local(void) int tty_local(void)
{ {
struct termios Tios; struct termios Tios;
tcflag_t cflag; tcflag_t cflag;
speed_t ispeed, ospeed; speed_t ispeed, ospeed;
int rc; int rc;
if ((rc = tcgetattr(0,&Tios))) { if ((rc = tcgetattr(0,&Tios))) {
WriteError("$tcgetattr(0,save) return %d",rc); WriteError("$tcgetattr(0,save) return %d",rc);
return rc;
}
Syslog('-', "Dropping DTR");
cflag = Tios.c_cflag | CLOCAL;
ispeed = cfgetispeed(&tios);
ospeed = cfgetospeed(&tios);
cfsetispeed(&Tios,0);
cfsetospeed(&Tios,0);
if ((rc = tcsetattr(0,TCSADRAIN,&Tios)))
WriteError("$tcsetattr(0,TCSADRAIN,hangup) return %d",rc);
sleep(1); /* as far as I notice, DTR goes back high on next op. */
Tios.c_cflag = cflag;
cfsetispeed(&Tios,ispeed);
cfsetospeed(&Tios,ospeed);
if ((rc = tcsetattr(0,TCSADRAIN,&Tios)))
Syslog('t', "$tcsetattr(0,TCSADRAIN,clocal) return %d",rc);
return rc; return rc;
}
Syslog('-', "Dropping DTR");
cflag = Tios.c_cflag | CLOCAL;
ispeed = cfgetispeed(&tios);
ospeed = cfgetospeed(&tios);
cfsetispeed(&Tios,0);
cfsetospeed(&Tios,0);
if ((rc = tcsetattr(0,TCSADRAIN,&Tios)))
WriteError("$tcsetattr(0,TCSADRAIN,hangup) return %d",rc);
sleep(1); /* as far as I notice, DTR goes back high on next op. */
Tios.c_cflag = cflag;
cfsetispeed(&Tios,ispeed);
cfsetospeed(&Tios,ospeed);
if ((rc = tcsetattr(0,TCSADRAIN,&Tios)))
Syslog('t', "$tcsetattr(0,TCSADRAIN,clocal) return %d",rc);
return rc;
} }
int tty_nolocal(void) int tty_nolocal(void)
{ {
struct termios Tios; struct termios Tios;
int rc; int rc;
if ((rc = tcgetattr(0,&Tios))) { if ((rc = tcgetattr(0,&Tios))) {
WriteError("$tcgetattr(0,save) return %d",rc); WriteError("$tcgetattr(0,save) return %d",rc);
return rc;
}
Tios.c_cflag &= ~CLOCAL;
Tios.c_cflag |= CRTSCTS;
if ((rc = tcsetattr(0,TCSADRAIN,&Tios)))
Syslog('t', "$tcsetattr(0,TCSADRAIN,clocal) return %d",rc);
return rc; return rc;
}
Tios.c_cflag &= ~CLOCAL;
Tios.c_cflag |= CRTSCTS;
if ((rc = tcsetattr(0,TCSADRAIN,&Tios)))
Syslog('t', "$tcsetattr(0,TCSADRAIN,clocal) return %d",rc);
return rc;
} }
int tty_cooked(void) int tty_cooked(void)
{ {
int rc; int rc;
if ((rc = tcsetattr(0,TCSAFLUSH,&savetios))) if ((rc = tcsetattr(0,TCSAFLUSH,&savetios)))
Syslog('t', "$tcsetattr(0,TCSAFLUSH,save) return %d",rc); Syslog('t', "$tcsetattr(0,TCSAFLUSH,save) return %d",rc);
return rc; return rc;
} }
speed_t transpeed(int speed) speed_t transpeed(int speed)
{ {
speed_t tspeed; speed_t tspeed;
switch (speed) switch (speed) {
{
case 0: tspeed=0; break; case 0: tspeed=0; break;
#if defined(B50) #if defined(B50)
case 50: tspeed=B50; break; case 50: tspeed=B50; break;
@ -608,9 +617,9 @@ speed_t transpeed(int speed)
#endif #endif
default: WriteError("requested invalid speed %d",speed); default: WriteError("requested invalid speed %d",speed);
tspeed=0; break; tspeed=0; break;
} }
return tspeed; return tspeed;
} }

View File

@ -1,9 +1,11 @@
#ifndef _OPENPORT_H #ifndef _OPENPORT_H
#define _OPENPORT_H #define _OPENPORT_H
/* $Id$ */
void linedrop(int); void linedrop(int);
void interrupt(int); void interrupt(int);
void sigpipe(int);
#ifdef TIOCWONLINE #ifdef TIOCWONLINE
void alarmsig(int); void alarmsig(int);
#endif #endif

View File

@ -149,7 +149,10 @@ int opentcp(char *name)
return -1; return -1;
} }
signal(SIGPIPE,linedrop); Syslog('d', "SIGPIPE => sigpipe()");
signal(SIGPIPE, sigpipe);
Syslog('d', "SIGHUP => linedrop()");
signal(SIGHUP, linedrop);
fflush(stdin); fflush(stdin);
fflush(stdout); fflush(stdout);
setbuf(stdin,NULL); setbuf(stdin,NULL);
@ -202,7 +205,10 @@ void closetcp(void)
tel_leave_binary(3); tel_leave_binary(3);
shutdown(fd, 2); shutdown(fd, 2);
signal(SIGPIPE,SIG_DFL); Syslog('d', "SIGHUP => SIG_IGN");
signal(SIGHUP, SIG_IGN);
Syslog('d', "SIGPIPE => SIG_IGN");
signal(SIGPIPE, SIG_IGN);
if (carrier) { if (carrier) {
c_end = time(NULL); c_end = time(NULL);