🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #22999

Re: control.cancel --> /dev/null

#22999
From: Michael Shields
Date: Thu, 06 Nov 1997 00:00
58 lines
2312 bytes
In article <63pe46$pbq$1@bigred.inka.de>,
olaf@bigred.inka.de (Olaf Titz) wrote:
> No, that won't work. But you can do this:
> 
>  cd $SPOOL/control; mv cancel cancel.old; rm -rf cancel.old
> 
> about once per hour out of crontab.

Sheesh.  The patch I run is pretty ugly, but it doesn't throw effort away.

diff -u -r1.16 -r1.17
--- art.c	1997/09/09 19:43:42	1.16
+++ art.c	1997/09/09 20:51:15	1.17
@@ -553,6 +553,7 @@
     IOVEC		*end;
     char		bytesbuff[SMBUF];
     int			i;
+    int			reallywrite; /* cheap hack --Shields 1997-09-09 */
 
     if ((p = HeaderFind(Article->Data, "Path", 4)) == NULL
      || p == Article->Data) {
@@ -562,8 +563,11 @@
 	return -1;
     }
 
+    reallywrite = strncmp(name, "control/cancel/", 15);
+
     /* Open the file. */
-    if ((fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, ARTFILE_MODE)) < 0) {
+    if (reallywrite
+	&& (fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, ARTFILE_MODE)) < 0) {
 	if (errno != ENOENT)
 	    IOError(WHEN, errno);
 	return -1;
@@ -630,7 +634,7 @@
     ARTheaders[_bytes].Found = 1;
 
     /* Now do the write. */
-    if (xwritev(fd, iov, vp - iov) < 0) {
+    if (reallywrite && xwritev(fd, iov, vp - iov) < 0) {
 	i = errno;
 	syslog(L_ERROR, "%s cant write %s %m", LogName, name);
 	IOError(WHEN, i);
@@ -642,7 +646,7 @@
 	}
 	return -1;
     }
-    if (close(fd) < 0) {
+    if (reallywrite && close(fd) < 0) {
 	i = errno;
 	syslog(L_ERROR, "%s cant close %s %m", LogName, name);
 	IOError(WHEN, i);

-- 
Shields, CrossLink.

Technical Details
Message-ID: <g6sotaa7g2.fsf@daedalus.crosslink.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
References: <Pine.HPP.3.95.971104124352.7722A-100000@iriquois.eel.ufl.edu> <63pe46$pbq$1@bigred.inka.de>

Show Full Headers
Complete Article Headers
Message-ID: <g6sotaa7g2.fsf@daedalus.crosslink.net>
Subject: Re: control.cancel --> /dev/null
Date: Thu, 06 Nov 1997 00:00:00 +0000
From: shields@crosslink.net (Michael Shields)
References: <Pine.HPP.3.95.971104124352.7722A-100000@iriquois.eel.ufl.edu> <63pe46$pbq$1@bigred.inka.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 287342958
Mail-Copies-To: never
X-Complaints-To: abuse@crosslink.net
X-Trace: kronos.crosslink.net 878796149 2849 shields 206.246.124.8
Organization: CrossLink Internet Services
Newsgroups: news.software.nntp