diff -u -r1.1.1.34 fetchmail.c --- fetchmail.c 13 Dec 2002 05:09:04 -0000 1.1.1.34 +++ fetchmail.c 31 Jan 2003 12:45:21 -0000 @@ -247,9 +247,19 @@ system("uname -a"); } + /* construct the lockfile */ + lock_setup(); + + /* check for another fetchmail running concurrently */ + pid = lock_state(); + bkgd = (pid < 0); + pid = bkgd ? -pid : pid; + /* avoid parsing the config file if all we're doing is killing a daemon */ - if (!(quitmode && argc == 2)) + if (!quitmode && !pid) implicitmode = load_params(argc, argv, optind); + else if (pid) + implicitmode = 1; #if defined(HAVE_SYSLOG) /* logging should be set up early in case we were restarted from exec */ @@ -267,9 +277,6 @@ #endif report_init((run.poll_interval == 0 || nodetach) && !run.logfile); - /* construct the lockfile */ - lock_setup(); - #ifdef HAVE_SETRLIMIT /* * Before getting passwords, disable core dumps unless -v -d0 mode is on. @@ -348,13 +355,8 @@ exit(0); } - /* check for another fetchmail running concurrently */ - pid = lock_state(); - bkgd = (pid < 0); - pid = bkgd ? -pid : pid; - /* if no mail servers listed and nothing in background, we're done */ - if (!(quitmode && argc == 2) && pid == 0 && querylist == NULL) { + if (!quitmode && pid == 0 && querylist == NULL) { (void)fputs(GT_("fetchmail: no mailservers have been specified.\n"),stderr); exit(PS_SYNTAX); } @@ -365,8 +367,7 @@ if (pid == 0) { fprintf(stderr,GT_("fetchmail: no other fetchmail is running\n")); - if (argc == 2) - exit(PS_EXCLUDE); + exit(PS_EXCLUDE); } else if (kill(pid, SIGTERM) < 0) { @@ -379,10 +380,7 @@ fprintf(stderr,GT_("fetchmail: %s fetchmail at %d killed.\n"), bkgd ? GT_("background") : GT_("foreground"), pid); lock_release(); - if (argc == 2) - exit(0); - else - pid = 0; + exit(0); } } @@ -412,12 +410,6 @@ else if (getpid() == pid) /* this test enables re-execing on a changed rcfile */ lock_assert(); - else if (argc > 1) - { - fprintf(stderr, - GT_("fetchmail: can't accept options while a background fetchmail is running.\n")); - return(PS_EXCLUDE); - } else if (kill(pid, SIGUSR1) == 0) { fprintf(stderr,