Thread View: news.software.readers
1 messages
1 total messages
Started by Ian T Zimmerman
Sun, 06 Apr 1997 00:00
Re: slrn exits on ^Z
Author: Ian T Zimmerman
Date: Sun, 06 Apr 1997 00:00
Date: Sun, 06 Apr 1997 00:00
162 lines
5256 bytes
5256 bytes
In article <slrn5kejve.dtt.nospam@unix1.netaxs.com>,
Bob Alpert <nospam@bucket.bit> writes:
> When I use the csh ^Z job-control function, slrn will frequently
> write out .newsrc and exit rather than stopping. This happens most
> frequently if an article is piped through a shell command sometime
> during the newsreading session -- a subsequent ^Z will cause slrn to
> exit.
You can try this patch. I posted it here a few weeks ago, JED
incorporated other parts of it, but not this one (probably he didn't
understand what it was about, which is entirely my fault).
--- autoconf/configure.in Sun Feb 23 17:07:35 1997
+++ ./configure.in Mon Feb 24 17:48:42 1997
@@ -44,6 +44,53 @@
siglongjmp
)
+#itz 02-07-97 Linux system() is broken :-(
+AC_C_CONST
+AC_TYPE_SIGNAL
+AC_CACHE_CHECK([if your system() routine is broken by signals],
+ itz_cv_func_system_broken,[AC_TRY_RUN(
+[
+#include <stdlib.h>
+#include <signal.h>
+#include <unistd.h>
+#include <limits.h>
+#include <stdio.h>
+
+static $ac_cv_type_signal handle_usr1 (int signo)
+{
+ return;
+}
+
+int main (int argc, char** argv)
+{
+ if (argc > 1) {
+ int ppid = atoi(argv[1]);
+ kill(ppid, SIGUSR1);
+ sleep(5);
+ exit(0);
+ } else {
+ int status;
+ char cmd [PATH_MAX+10];
+ static char logmsg [] = "system() returned nonzero status\n";
+ signal(SIGUSR1, handle_usr1);
+ sprintf(cmd, "%s %d", argv[0], getpid());
+ status = system(cmd);
+ if (status) {
+ write(5, logmsg, sizeof(logmsg)-1);
+ }
+ exit(status);
+ } /*if*/
+}
+],
+[itz_cv_func_system_broken=no],
+[itz_cv_func_system_broken=yes],
+[itz_cv_func_system_broken=yes])
+])
+
+if test "$itz_cv_func_system_broken" = "yes"; then
+ AC_DEFINE(BROKEN_SYSTEM)
+fi
+
AC_CACHE_CHECK(for domain in /etc/resolv.conf, slrn_cv_domain,
[if test -f /etc/resolv.conf; then
slrn_cv_domain=`(grep "^domain" /etc/resolv.conf ||
--- src/misc.c.orig Sun Feb 23 17:07:38 1997
+++ src/misc.c Mon Feb 24 19:27:19 1997
@@ -803,8 +803,75 @@
/*}}}*/
-
/*}}}*/
+
+/* itz 02-07-97 to avoid further complications, I only try to fix this
+ on otherwise POSIX systems. Other users will have to put up with
+ their library system() behaviour. */
+
+#ifdef SLRN_POSIX_SIGNALS
+#ifdef BROKEN_SYSTEM
+/* itz 02-07-97 this version is from APUE (W R Stevens, Addison Wesley
+ 1992, p.314 */
+static int system (const char* cmd) /* {{{ */
+{
+ pid_t pid;
+ int status;
+ struct sigaction ignore, saveintr, savequit;
+ sigset_t chldmask, savemask;
+
+ if (cmd == 0) {
+ return 1;
+ } /*if*/
+ ignore.sa_handler = SIG_IGN; /* ignore SIGINT and SIGQUIT */
+ sigemptyset(&ignore.sa_mask);
+ ignore.sa_flags = 0;
+ if (sigaction(SIGINT, &ignore, &saveintr) < 0) {
+ return -1;
+ } /*if*/
+ if (sigaction(SIGQUIT, &ignore, &savequit) < 0) {
+ return -1;
+ } /*if*/
+ sigemptyset(&chldmask); /* now block SIGCHLD */
+ sigaddset(&chldmask, SIGCHLD);
+ if (sigprocmask(SIG_BLOCK, &chldmask, &savemask) < 0) {
+ return -1;
+ } /*if*/
+ if ((pid = fork ()) < 0) {
+ status = -1; /* probably out of processes */
+ } else if (pid == 0) { /* child */
+ /* restore previous signal actions and reset signal mask */
+ sigaction(SIGINT, &saveintr, 0);
+ sigaction(SIGQUIT, &savequit, 0);
+ sigprocmask(SIG_SETMASK, &savemask, 0);
+
+ execl("/bin/sh", "sh", "-c", cmd, (char*)(0));
+ _exit(127); /* shouldn't get here */
+ } else { /* parent */
+ while (waitpid(pid, &status, 0) < 0) {
+ /* itz 02-07-97 !!! this is where my library's system() fails */
+ if (errno != EINTR) {
+ status = -1;
+ break;
+ } /*if*/
+ } /*while*/
+ } /*if*/
+ /* restore previous signal actions and reset signal mask */
+ if (sigaction(SIGINT, &saveintr, 0) < 0) {
+ return -1;
+ } /*if*/
+ if (sigaction(SIGQUIT, &savequit, 0) < 0) {
+ return -1;
+ } /*if*/
+ if (sigprocmask(SIG_SETMASK, &savemask, 0) < 0) {
+ return -1;
+ } /*if*/
+
+ return status;
+}
+ /* }}} */
+#endif /* BROKEN_SYSTEM */
+#endif /* SLRN_POSIX_SIGNALS */
int slrn_posix_system (char *cmd, int reset) /*{{{*/
{
Note that you'll need to run GNU autoconf after applying this, and for
that you'll need to download acsite.m4 from JED'd ftp site.
Best,
--
Ian T Zimmerman <itz@rahul.net>
I fully support the President's proposal to test driver's license
applicants for drugs. Any plan to reduce driving is worth a try.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads