summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--qarshd.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/qarshd.c b/qarshd.c
index 950135e..91e2501 100644
--- a/qarshd.c
+++ b/qarshd.c
@@ -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);