LCOV - code coverage report
Current view: top level - lib - signal.c (source / functions) Hit Total Coverage
Test: smtpd.info Lines: 8 10 80.0 %
Date: 2015-11-25 19:06:20 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /* This file is part of the cmail project (http://cmail.rocks/)
       2             :  * (c) 2015 Fabian "cbdev" Stumpf
       3             :  * License: Simplified BSD (2-Clause)
       4             :  * For further information, consult LICENSE.txt
       5             :  */
       6             : 
       7           1 : void signal_handle(int signum){
       8           1 :         abort_signaled = 1;
       9           1 : }
      10             : 
      11           1 : int signal_init(LOGGER log){
      12           1 :         struct sigaction act = {
      13             :                 .sa_handler=&signal_handle
      14             :         };
      15             : 
      16             :         //FIXME use sigaction for this too
      17           1 :         signal(SIGPIPE, SIG_IGN);
      18             : 
      19           1 :         if(sigaction(SIGTERM, &act, NULL) < 0 || sigaction(SIGINT, &act, NULL) < 0) {
      20           0 :                 logprintf(log, LOG_ERROR, "Failed to set signal mask\n");
      21           0 :                 return -1;
      22             :         }
      23             : 
      24           1 :         return 0;
      25             : }

Generated by: LCOV version 1.11