From 06470851ed8433e49fcb9de36f0010d2c2d6b7cc Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sun, 23 Jul 2000 03:40:34 +0000 Subject: [PATCH] Minor update. svn path=/trunk/; revision=2927 --- COPYING | 2 +- Makefile.in | 4 ++-- NEWS | 5 ++++- configure.in | 2 +- daemon.c | 33 +++++++++++++++++++++++++++++++++ fetchmail.c | 2 +- fetchmailconf | 4 ++-- sink.c | 22 ++++++++++++++++++++++ 8 files changed, 66 insertions(+), 8 deletions(-) diff --git a/COPYING b/COPYING index a234e13b..8ae894ac 100644 --- a/COPYING +++ b/COPYING @@ -5,7 +5,7 @@ retained for the purpose of protecting free redistribution of source. The MD5 support is copyright by RSA Data Security, Inc. See the header comment of the md5.c module for license terms. - NO-VIRUS CLAUSE + NO-INFECTION CLAUSE The intent of this license is to protect free redistribution and reuse of the source of the licensed distribution, not to prejudice the authorship diff --git a/Makefile.in b/Makefile.in index 2de1f26d..0f08dad9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -4,7 +4,7 @@ # So just uncomment all the lines marked QNX. PACKAGE = fetchmail -VERSION = 5.4.3 +VERSION = 5.4.4 SUBDIRS = @INTLSUB@ @POSUB@ @@ -18,7 +18,7 @@ CC = @CC@ CFLAGS = @CFLAGS@ # CFLAGS = -g2 -5 # QNX LDFLAGS = @LDFLAGS@ -# LDFLAGS = -g2 -5 # QNX +# LDFLAGS = -g2 -5 -N64k # QNX LEX = @LEX@ LEXFLAGS= YACC = @YACC@ diff --git a/NEWS b/NEWS index 76c6d393..e9f6659c 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,10 @@ (The `lines' figures total .c, .h, .l, and .y files under version control.) -fetchmail-5.4.2 (Sun Jul 2 14:24:28 EDT 2000), 19080 lines: +* Guenther H. Leber's fix to show expunge parameters for POP3 in fetchmail -V. +* Richard Gooch's fixes to use sigation(2) in sink.c and daemon.c + +fetchmail-5.4.3 (Sun Jul 2 14:24:28 EDT 2000), 19080 lines: * Fixed Debian bug #63667, fetchmailconf: doesn't write .fetchmailrc properly. * RFC2177 IDLE should now be done even when there are no messages. diff --git a/configure.in b/configure.in index 52a06f95..13094fd9 100644 --- a/configure.in +++ b/configure.in @@ -141,7 +141,7 @@ AC_SUBST(EXTRAOBJ) AC_CHECK_FUNCS(tcsetattr stty setsid geteuid seteuid gethostbyname \ res_search herror strrchr strerror setlinebuf syslog \ snprintf vprintf vsnprintf vsyslog \ - atexit inet_aton strftime setrlimit socketpair sigprocmask) + atexit inet_aton strftime setrlimit socketpair sigprocmask sigaction) # Under Red Hat 4.0 (and many other Linuxes) -lresolv is seriously flaky # and breaks gethostbyname(2). It's better to use the bind stuff in the C diff --git a/daemon.c b/daemon.c index 64b1c90d..a12f2c70 100644 --- a/daemon.c +++ b/daemon.c @@ -88,6 +88,9 @@ daemonize (const char *logfile, void (*termhook)(int)) int fd; pid_t childpid; RETSIGTYPE sigchld_handler(int); +#ifdef HAVE_SIGACTION + struct sigaction sa_new; +#endif /* HAVE_SIGACTION */ /* if we are started by init (process 1) via /etc/inittab we needn't bother to detach from our process group context */ @@ -96,14 +99,31 @@ daemonize (const char *logfile, void (*termhook)(int)) goto nottyDetach; /* Ignore BSD terminal stop signals */ +#ifdef HAVE_SIGACTION + memset (&sa_new, 0, sizeof sa_new); + sigemptyset (&sa_new.sa_mask); + sa_new.sa_handler = SIG_IGN; +#endif /* HAVE_SIGACTION */ #ifdef SIGTTOU +#ifndef HAVE_SIGACTION signal(SIGTTOU, SIG_IGN); +#else + sigaction (SIGTTOU, &sa_new, NULL); +#endif /* HAVE_SIGACTION */ #endif #ifdef SIGTTIN +#ifndef HAVE_SIGACTION signal(SIGTTIN, SIG_IGN); +#else + sigaction (SIGTTIN, &sa_new, NULL); +#endif /* HAVE_SIGACTION */ #endif #ifdef SIGTSTP +#ifndef HAVE_SIGACTION signal(SIGTSTP, SIG_IGN); +#else + sigaction (SIGTSTP, &sa_new, NULL); +#endif /* HAVE_SIGACTION */ #endif /* In case we were not started in the background, fork and let @@ -144,7 +164,11 @@ daemonize (const char *logfile, void (*termhook)(int)) #endif /* lose controlling tty */ +#ifndef HAVE_SIGACTION signal(SIGHUP, SIG_IGN); +#else + sigaction (SIGHUP, &sa_new, NULL); +#endif /* HAVE_SIGACTION */ if ((childpid = fork()) < 0) { report(stderr, "fork (%)\n", strerror(errno)); return(PS_IOERR); @@ -197,9 +221,18 @@ nottyDetach: #endif /* set up to catch child process termination signals */ +#ifndef HAVE_SIGACTION signal(SIGCHLD, sigchld_handler); +#else + sa_new.sa_handler = sigchld_handler; + sigaction (SIGCHLD, &sa_new, NULL); +#endif /* HAVE_SIGACTION */ #if defined(SIGPWR) +#ifndef HAVE_SIGACTION signal(SIGPWR, sigchld_handler); +#else + sigaction (SIGPWR, &sa_new, NULL); +#endif /* HAVE_SIGACTION */ #endif return(0); diff --git a/fetchmail.c b/fetchmail.c index b1cf9cb8..33041b9d 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -1612,7 +1612,7 @@ static void dump_params (struct runctl *runp, printf(_(" SMTP message batch limit is %d.\n"), ctl->batchlimit); else if (outlevel >= O_VERBOSE) printf(_(" No SMTP message batch limit (--batchlimit 0).\n")); - if (ctl->server.protocol == P_IMAP) + if (ctl->server.protocol != P_ETRN) { if (NUM_NONZERO(ctl->expunge)) printf(_(" Deletion interval between expunges forced to %d (--expunge %d).\n"), ctl->expunge, ctl->expunge); diff --git a/fetchmailconf b/fetchmailconf index 7f3778f7..16fc806c 100755 --- a/fetchmailconf +++ b/fetchmailconf @@ -1522,8 +1522,8 @@ class UserEdit(Frame, MyWidget): self.fetchlimit, '30').pack(side=TOP, fill=X) LabeledEntry(limwin, 'Max messages to forward per poll:', self.batchlimit, '30').pack(side=TOP, fill=X) - if self.parent.server.protocol in ('IMAP', 'IMAP-K4', 'IMAP-GSS'): - LabeledEntry(limwin, 'Interval between expunges (IMAP):', + if self.parent.server.protocol != 'ETRN': + LabeledEntry(limwin, 'Interval between expunges:', self.expunge, '30').pack(side=TOP, fill=X) Checkbutton(limwin, text="Idle after each poll (IMAP only)", variable=self.idle).pack(side=TOP, anchor=W) diff --git a/sink.c b/sink.c index 8c3d5f54..519fc2bd 100644 --- a/sink.c +++ b/sink.c @@ -169,7 +169,11 @@ static int smtp_open(struct query *ctl) /* these are shared by open_sink and stuffline */ static FILE *sinkfp; +#ifndef HAVE_SIGACTION static RETSIGTYPE (*sigchld)(int); +#else +static struct sigaction sa_old; +#endif /* HAVE_SIGACTION */ int stuffline(struct query *ctl, char *buf) /* ship a line to the given control block's output sink (SMTP server or MDA) */ @@ -488,6 +492,9 @@ int open_sink(struct query *ctl, struct msgblk *msg, /* set up sinkfp to be an input sink we can ship a message to */ { struct idlist *idp; +#ifdef HAVE_SIGACTION + struct sigaction sa_new; +#endif /* HAVE_SIGACTION */ *bad_addresses = *good_addresses = 0; @@ -688,7 +695,14 @@ int open_sink(struct query *ctl, struct msgblk *msg, return(PS_IOERR); } +#ifndef HAVE_SIGACTION sigchld = signal(SIGCHLD, SIG_DFL); +#else + memset (&sa_new, 0, sizeof sa_new); + sigemptyset (&sa_new.sa_mask); + sa_new.sa_handler = SIG_DFL; + sigaction (SIGCHLD, &sa_new, &sa_old); +#endif /* HAVE_SIGACTION */ } else /* forward to an SMTP or LMTP listener */ { @@ -873,7 +887,11 @@ void release_sink(struct query *ctl) pclose(sinkfp); sinkfp = (FILE *)NULL; } +#ifndef HAVE_SIGACTION signal(SIGCHLD, sigchld); +#else + sigaction (SIGCHLD, &sa_old, NULL); +#endif /* HAVE_SIGACTION */ } } @@ -892,7 +910,11 @@ int close_sink(struct query *ctl, struct msgblk *msg, flag forward) } else rc = 0; +#ifndef HAVE_SIGACTION signal(SIGCHLD, sigchld); +#else + sigaction (SIGCHLD, &sa_old, NULL); +#endif /* HAVE_SIGACTION */ if (rc) { report(stderr, -- 2.43.2