--- embedtools/src/wdog.c 2010/10/18 11:13:50 1.1.2.5 +++ embedtools/src/wdog.c 2010/10/18 11:20:37 1.1.2.6 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ - * $Id: wdog.c,v 1.1.2.5 2010/10/18 11:13:50 misho Exp $ + * $Id: wdog.c,v 1.1.2.6 2010/10/18 11:20:37 misho Exp $ * *************************************************************************/ #include "global.h" @@ -23,6 +23,7 @@ Usage() "\t-v\t\tVerbose ...\n" "\t-c \tBefore execute chroot to dir [default=/]\n" "\t-u \tBefore execute change user\n" + "\t-P\t\tInfinit loop, bypass penalty timeout\n" "\n", compiled, compiledby, compilehost); } @@ -45,18 +46,21 @@ sigHand(int sig) int main(int argc, char **argv) { - char ch, szChroot[MAXPATHLEN] = "/"; + char ch, bypass = 0, szChroot[MAXPATHLEN] = "/"; int status = 0, ret = 1; struct sigaction sa; struct passwd *pass = NULL; uid_t uid = getuid(); u_int penalty = 1; - while ((ch = getopt(argc, argv, "vhc:u:")) != -1) + while ((ch = getopt(argc, argv, "vhPc:u:")) != -1) switch (ch) { case 'v': Verbose++; break; + case 'P': + bypass = 1; + break; case 'c': if (uid) { printf("Error:: can`t chroot, please run as root!\n"); @@ -149,8 +153,10 @@ main(int argc, char **argv) } /* penalty timeout retry */ usleep(penalty); - penalty <<= 1; - VERB(2) printf("Info:: penalty timeout %u microseconds\n", penalty); + if (!bypass) { + penalty <<= 1; + VERB(2) printf("Info:: penalty timeout %u microseconds\n", penalty); + } } if (!penalty) ret = 9;