From 8fa6fc9a2f0770e62c681bc6a01cc89b51f90944 Mon Sep 17 00:00:00 2001 From: Amit Kucheria Date: Tue, 11 Dec 2018 12:15:07 +0530 Subject: [PATCH] cdba: Make inactivity timeout a default Reverse the logic of inactivity timeout so that by default we set inactivity timeout to 600s. Passing -T 0 disables inactivity timeout completely. Signed-off-by: Amit Kucheria --- cdba.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cdba.c b/cdba.c index cd54857..1501c5f 100644 --- a/cdba.c +++ b/cdba.c @@ -467,7 +467,7 @@ static void usage(void) int main(int argc, char **argv) { - bool timeout_on_inactivity = false; + bool timeout_on_inactivity = true; struct termios *orig_tios; struct work *next; struct work *work; @@ -481,7 +481,7 @@ int main(int argc, char **argv) char buf[128]; fd_set rfds; fd_set wfds; - int timeout = 0; + int timeout = 600; ssize_t n; int nfds; int opt; @@ -500,10 +500,11 @@ int main(int argc, char **argv) break; case 't': timeout = atoi(optarg); + if (timeout == 0) + timeout_on_inactivity = false; break; case 'T': timeout = atoi(optarg); - timeout_on_inactivity = true; break; default: usage();