diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2010-12-18 16:07:57 +0100 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2016-07-06 10:03:46 +0200 |
commit | 36c5075506895b66e783b76355013de66823fb3d (patch) | |
tree | 9296bc7cad0bd7fecaa90b1a0ce61bd85675c60f /fetchmail.c | |
parent | 1ae9d7bf1499cb005a52030ab4ed51a37ec81b02 (diff) | |
download | fetchmail-36c5075506895b66e783b76355013de66823fb3d.tar.gz fetchmail-36c5075506895b66e783b76355013de66823fb3d.tar.bz2 fetchmail-36c5075506895b66e783b76355013de66823fb3d.zip |
Accept more options with a running daemon.
(Cherry-picked from master's 1a92b2909610096a11d26f7a7317d32819354be3.)
Diffstat (limited to 'fetchmail.c')
-rw-r--r-- | fetchmail.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/fetchmail.c b/fetchmail.c index 22d492ae..8b0a5c3d 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -159,6 +159,8 @@ int main(int argc, char **argv) { int bkgd = FALSE; int implicitmode = FALSE; + flag safewithbg = FALSE; /** if parsed options are compatible with a + fetchmail copy running in the background */ struct query *ctl; netrc_entry *netrc_list; char *netrc_file, *tmpbuf; @@ -202,7 +204,7 @@ int main(int argc, char **argv) #define IDFILE_NAME ".fetchids" run.idfile = prependdir (IDFILE_NAME, fmhome); - + outlevel = O_NORMAL; /* @@ -226,7 +228,7 @@ int main(int argc, char **argv) { int i; - i = parsecmdline(argc, argv, &cmd_run, &cmd_opts); + i = parsecmdline(argc, argv, &cmd_run, &cmd_opts, &safewithbg); if (i < 0) exit(PS_SYNTAX); @@ -541,17 +543,23 @@ int main(int argc, char **argv) else if (getpid() == pid) /* this test enables re-execing on a changed rcfile */ fm_lock_assert(); - else if (argc > 1) + else if (argc > 1 && !safewithbg) { fprintf(stderr, GT_("fetchmail: can't accept options while a background fetchmail is running.\n")); + { + int i; + fprintf(stderr, "argc = %d, arg list:\n", argc); + for (i = 1; i < argc; i++) fprintf(stderr, "arg %d = \"%s\"\n", i, argv[i]); + } return(PS_EXCLUDE); } else if (kill(pid, SIGUSR1) == 0) { - fprintf(stderr, - GT_("fetchmail: background fetchmail at %ld awakened.\n"), - (long)pid); + if (outlevel > O_SILENT) + fprintf(stderr, + GT_("fetchmail: background fetchmail at %ld awakened.\n"), + (long)pid); return(0); } else |