ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/hopm/trunk/src/main.c
(Generate patch)

Comparing hopm/trunk/src/main.c (file contents):
Revision 8542 by michael, Sat Dec 31 13:59:46 2016 UTC vs.
Revision 8543 by michael, Sat Sep 22 20:32:41 2018 UTC

# Line 47 | Line 47 | static int REOPEN  = 0;  /* Flagged to r
47  
48   static struct sigaction ALARMACTION;
49   static struct sigaction INTACTION;
50 + static struct sigaction HUPACTION;
51   static struct sigaction USR1ACTION;
52  
53   static const char *CONFNAME = DEFAULTNAME;
# Line 70 | Line 71 | do_signal(int signum)
71        log_printf("MAIN -> Caught SIGINT, bye!");
72        exit(0);
73        break;
74 +    case SIGHUP:
75 +      RESTART = 1;
76 +      break;
77      case SIGUSR1:
78        REOPEN = 1;
79        break;
# Line 176 | Line 180 | main(int argc, char *argv[])
180    ALARMACTION.sa_handler = &do_signal;
181    ALARMACTION.sa_flags = SA_RESTART;
182    INTACTION.sa_handler = &do_signal;
183 +  HUPACTION.sa_handler = &do_signal;
184    USR1ACTION.sa_handler = &do_signal;
185  
186    sigaction(SIGALRM, &ALARMACTION, 0);
187    sigaction(SIGINT, &INTACTION, 0);
188 +  sigaction(SIGHUP, &HUPACTION, 0);
189    sigaction(SIGUSR1, &USR1ACTION, 0);
190  
191    /* Ignore SIGPIPE. */
# Line 214 | Line 220 | main(int argc, char *argv[])
220          fcntl(i, F_SETFD, FD_CLOEXEC);
221  
222        /* execute new process */
223 <      if (execv(argv[0], argv) == -1)
224 <        log_printf("MAIN RESTART -> Execution of \"%s\" failed. ERROR: %s", argv[0], strerror(errno));
223 >      if (execv(HOPM_BINPATH, argv) == -1)
224 >        log_printf("MAIN RESTART -> Execution of \"%s\" failed. ERROR: %s", HOPM_BINPATH, strerror(errno));
225  
226        exit(0);  /* Should only get here if execv() failed */
227      }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)