expireover.c patch
Heath Kehoe
heath.kehoe at intermec.com
Sun Apr 16 22:15:41 UTC 2000
Currently, if you kill expireover while it's running, it could corrupt
overview (at least, with ovdb) because it doesn't have a chance to
OVclose. This is a simple fix that allows it to exit cleanly from
a signal. This is kind of a bug fix, and I think it is appropriate
for inclusion into the 2.3 beta.
-heath
*** expireover.c.DIST Fri Nov 26 10:49:36 1999
--- expireover.c Sun Apr 16 17:03:05 2000
***************
*** 20,25 ****
--- 20,32 ----
exit(1);
}
+ static int signalled = 0;
+ void sigfunc(int sig)
+ {
+ signalled = 1;
+ xsignal(sig, SIG_DFL);
+ }
+
int main(int argc, char *argv[]) {
int i;
char activefn[BIG_BUFFER] = "";
***************
*** 104,109 ****
--- 111,120 ----
exit(1);
}
+ xsignal(SIGTERM, sigfunc);
+ xsignal(SIGINT, sigfunc);
+ xsignal(SIGHUP, sigfunc);
+
if (!OVopen(OV_READ | OV_WRITE)) {
fprintf(stderr, "expireover: could not open OV database\n");
exit(1);
***************
*** 132,137 ****
--- 143,150 ----
}
}
while ((line = QIOread(qp)) != NULL) {
+ if(signalled)
+ break;
if ((p = strchr(line, ' ')) != NULL)
*p = '\0';
if ((p = strchr(line, '\t')) != NULL)
***************
*** 146,154 ****
}
}
/* purge deleted newsgroups */
! if (!Nonull && !OVexpiregroup(NULL, NULL)) {
fprintf(stderr, "expireover: could not expire purged newsgroups\n");
}
QIOclose(qp);
OVclose();
--- 159,170 ----
}
}
/* purge deleted newsgroups */
! if (!signalled && !Nonull && !OVexpiregroup(NULL, NULL)) {
fprintf(stderr, "expireover: could not expire purged newsgroups\n");
}
+ if(signalled)
+ fprintf(stderr, "expireover: received signal; exiting\n");
+
QIOclose(qp);
OVclose();
More information about the inn-workers
mailing list