From: John Hodge Date: Wed, 15 Apr 2015 04:33:11 +0000 (+0800) Subject: Server - Ignore SIGPIPE (just let it return a read error) X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=bc9985b6194aabd4439933925f50e249610577d0;p=tpg%2Fopendispense2.git Server - Ignore SIGPIPE (just let it return a read error) --- diff --git a/src/server/main.c b/src/server/main.c index efa354e..9359c4e 100644 --- a/src/server/main.c +++ b/src/server/main.c @@ -136,8 +136,11 @@ int main(int argc, char *argv[]) gsCoke_ModbusAddress = Config_GetValue("coke_modbus_address", 0); giCoke_ModbusPort = Config_GetValue_Int("coke_modbus_port", 0); + // - Cleanly tear down the server on SIGINT/SIGTERM signal(SIGINT, sigint_handler); signal(SIGTERM, sigint_handler); + // - ignore SIGPIPE to prevent a crashing client from bringing the server down too + signal(SIGPIPE, SIG_IGN); openlog("odispense2", 0, LOG_LOCAL4);