makehistory patch for -F option
Heath Kehoe
heath.kehoe at intermec.com
Thu Jul 13 21:23:54 UTC 2000
This patch should fix the problem with corrupt history when
using -F.
-h
*** makehistory.c.dist Thu Jul 13 16:02:50 2000
--- makehistory.c Thu Jul 13 16:22:51 2000
***************
*** 230,244 ****
/* init the overview setup. */
if (!OVopen(OV_WRITE)) {
fprintf(stderr, "makehistory: OVopen failed\n");
! exit(1);
}
if (!OVctl(OVSORT, (void *)&sorttype)) {
fprintf(stderr, "makehistory: OVctl(OVSORT) failed\n");
! exit(1);
}
if (!OVctl(OVCUTOFFLOW, (void *)&Cutofflow)) {
fprintf(stderr, "makehistory: OVctl(OVCUTOFFLOW) failed\n");
! exit(1);
}
if(first)
--- 230,246 ----
/* init the overview setup. */
if (!OVopen(OV_WRITE)) {
fprintf(stderr, "makehistory: OVopen failed\n");
! _exit(1);
}
if (!OVctl(OVSORT, (void *)&sorttype)) {
fprintf(stderr, "makehistory: OVctl(OVSORT) failed\n");
! OVclose();
! _exit(1);
}
if (!OVctl(OVCUTOFFLOW, (void *)&Cutofflow)) {
fprintf(stderr, "makehistory: OVctl(OVCUTOFFLOW) failed\n");
! OVclose();
! _exit(1);
}
if(first)
***************
*** 257,263 ****
fprintf(stderr,
"makehistory: Can't sort OverTmp file (%s exit %d), %s\n",
_PATH_SORT, i, strerror(errno));
! exit(1);
}
/* don't need old path anymore. */
--- 259,266 ----
fprintf(stderr,
"makehistory: Can't sort OverTmp file (%s exit %d), %s\n",
_PATH_SORT, i, strerror(errno));
! OVclose();
! Fork ? _exit(1) : exit(1);
}
/* don't need old path anymore. */
***************
*** 269,275 ****
if ((qp = QIOopen(SortedTmpPath)) == NULL) {
fprintf(stderr, "makehistory: Can't open sorted over file %s, %s\n",
SortedTmpPath, strerror(errno));
! exit(1);
}
for (count = 1; (line = QIOread(qp)) != NULL ; ++count) {
--- 272,279 ----
if ((qp = QIOopen(SortedTmpPath)) == NULL) {
fprintf(stderr, "makehistory: Can't open sorted over file %s, %s\n",
SortedTmpPath, strerror(errno));
! OVclose();
! Fork ? _exit(1) : exit(1);
}
for (count = 1; (line = QIOread(qp)) != NULL ; ++count) {
***************
*** 278,284 ****
|| (r = strchr(q+1, '\t')) == NULL) {
fprintf(stderr, "makehistory: sorted over %s has bad line %d\n",
SortedTmpPath, count);
! exit(1);
}
/* p+1 now points to start of token, q+1 points to start of overline. */
if (sorttype == OVNEWSGROUP) {
--- 282,289 ----
|| (r = strchr(q+1, '\t')) == NULL) {
fprintf(stderr, "makehistory: sorted over %s has bad line %d\n",
SortedTmpPath, count);
! OVclose();
! Fork ? _exit(1) : exit(1);
}
/* p+1 now points to start of token, q+1 points to start of overline. */
if (sorttype == OVNEWSGROUP) {
***************
*** 291,297 ****
if ((r = strchr(r, '\t')) == NULL) {
fprintf(stderr, "makehistory: sorted over %s has bad line %d\n",
SortedTmpPath, count);
! exit(1);
}
*r++ = '\0';
} else {
--- 296,303 ----
if ((r = strchr(r, '\t')) == NULL) {
fprintf(stderr, "makehistory: sorted over %s has bad line %d\n",
SortedTmpPath, count);
! OVclose();
! Fork ? _exit(1) : exit(1);
}
*r++ = '\0';
} else {
***************
*** 305,311 ****
if (!OVadd(token, r, strlen(r), arrived, expires)) {
if (OVctl(OVSPACE, (void *)&i) && i == OV_NOSPACE) {
fprintf(stderr, "makehistory: no space left for overview\n");
! exit(1);
}
fprintf(stderr, "makehistory: Can't write overview data \"%s\"\n", q);
}
--- 311,318 ----
if (!OVadd(token, r, strlen(r), arrived, expires)) {
if (OVctl(OVSPACE, (void *)&i) && i == OV_NOSPACE) {
fprintf(stderr, "makehistory: no space left for overview\n");
! OVclose();
! Fork ? _exit(1) : exit(1);
}
fprintf(stderr, "makehistory: Can't write overview data \"%s\"\n", q);
}
***************
*** 313,324 ****
/* Check for errors and close. */
if (QIOtoolong(qp)) {
fprintf(stderr, "makehistory: Line %d is too long\n", count);
! exit(1);
}
if (QIOerror(qp)) {
(void)fprintf(stderr, "makehistory: Can't read sorted tmp file %s, %s\n",
SortedTmpPath, strerror(errno));
! exit(1);
}
QIOclose(qp);
/* unlink sorted tmp file */
--- 320,333 ----
/* Check for errors and close. */
if (QIOtoolong(qp)) {
fprintf(stderr, "makehistory: Line %d is too long\n", count);
! OVclose();
! Fork ? _exit(1) : exit(1);
}
if (QIOerror(qp)) {
(void)fprintf(stderr, "makehistory: Can't read sorted tmp file %s, %s\n",
SortedTmpPath, strerror(errno));
! OVclose();
! Fork ? _exit(1) : exit(1);
}
QIOclose(qp);
/* unlink sorted tmp file */
***************
*** 326,332 ****
DISPOSE(SortedTmpPath);
if(Fork) {
OVclose();
! exit(0);
}
}
--- 335,341 ----
DISPOSE(SortedTmpPath);
if(Fork) {
OVclose();
! _exit(0);
}
}
More information about the inn-workers
mailing list