diff options
author | Nathan Straz <nstraz@redhat.com> | 2013-08-15 14:13:51 -0400 |
---|---|---|
committer | Nathan Straz <nstraz@redhat.com> | 2013-09-11 17:49:23 -0400 |
commit | 5d2c8a24f2dec4f5edf4c5f4b3c3f35ca9561fd6 (patch) | |
tree | 63322897c8ed682a48a0975cfa47943a6c159d44 /qarshd.c | |
parent | 0fbaf9ea5bdd6b7a347d09dc4bb135cc777c7543 (diff) | |
download | qarsh-5d2c8a24f2dec4f5edf4c5f4b3c3f35ca9561fd6.tar.gz qarsh-5d2c8a24f2dec4f5edf4c5f4b3c3f35ca9561fd6.tar.xz qarsh-5d2c8a24f2dec4f5edf4c5f4b3c3f35ca9561fd6.zip |
Add option to pause at startup
This allows us to attach gdb before anything
interesting happens. Use the command
'signal 14' to get the process running again.
Diffstat (limited to 'qarshd.c')
-rw-r--r-- | qarshd.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -46,6 +46,7 @@ */ int debug = 0; +int dopause = 0; /* Globals */ struct sockaddr_storage peername; @@ -279,10 +280,11 @@ handle_packets(int infd) sa.sa_mask = sigmask; sa.sa_flags = SA_RESTART; sigaction(SIGCHLD, &sa, NULL); -#if 0 - signal(SIGALRM, sig_handler); - pause(); -#endif + if (dopause) { + signal(SIGALRM, sig_handler); + pause(); + signal(SIGALRM, SIG_DFL); + } for (;;) { FD_SET(infd, &rfds); @@ -397,11 +399,14 @@ main(int argc, char *argv[]) openlog("qarshd", LOG_PID, LOG_DAEMON); - while ((ch = getopt(argc, argv, "d")) != -1) { + while ((ch = getopt(argc, argv, "pd")) != -1) { switch (ch) { case 'd': debug = 1; break; + case 'p': + dopause = 1; + break; case '?': default: printf("unknown option '%c'\n", optopt); |