Commit 167c742f authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(cache_sync): Don't write 'I' records in version 0 files. Ignore 'I'

records in version 0 files, but warn about them.
parent 69bcd436
/*
* $Id: dbck-cache.c,v 0.24 1996/06/09 13:54:20 byers Exp $
* $Id: dbck-cache.c,v 0.25 1996/07/24 23:35:14 ceder Exp $
* Copyright (C) 1991, 1992, 1993, 1994, 1995 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -32,7 +32,7 @@
* Also save time as a time_t instead of a struct tm.
*/
static char *rcsid = "$Id: dbck-cache.c,v 0.24 1996/06/09 13:54:20 byers Exp $";
static char *rcsid = "$Id: dbck-cache.c,v 0.25 1996/07/24 23:35:14 ceder Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -596,12 +596,13 @@ cache_sync(void)
fprintf(fp, "#T %d\n", next_text_num);
}
fprintf(fp, "I %d %d %d %d %ld\n",
kom_info.conf_pres_conf,
kom_info.pers_pres_conf,
kom_info.motd_conf,
kom_info.kom_news_conf,
kom_info.motd_of_lyskom);
if (oformat == 1)
fprintf(fp, "I %d %d %d %d %ld\n",
kom_info.conf_pres_conf,
kom_info.pers_pres_conf,
kom_info.motd_conf,
kom_info.kom_news_conf,
kom_info.motd_of_lyskom);
for ( i = 1; i < next_free_num; i++ ) /* CONFS */
{
......@@ -824,13 +825,33 @@ init_cache(void)
break;
case 'I':
if (data_file_version == 0)
restart_kom("init_cache(): new type record in old file\n");
kom_info.conf_pres_conf = fparse_long(fp);
kom_info.pers_pres_conf = fparse_long(fp);
kom_info.motd_conf = fparse_long(fp);
kom_info.kom_news_conf = fparse_long(fp);
kom_info.motd_of_lyskom = fparse_long(fp);
switch (data_file_version)
{
case 0:
#if 1
log("init_cache(): 'I' record in old file ignored\n");
#else
/* dbck.c does not yet export confirm() and rflag and... */
log("'I' record found in version 0 data file.\n");
if (rflag || confirm("Repair by ignoring it? "))
{
modifications++;
log("Repair by ignoring it.");
}
else
error++;
#endif
break;
case 1:
kom_info.conf_pres_conf = fparse_long(fp);
kom_info.pers_pres_conf = fparse_long(fp);
kom_info.motd_conf = fparse_long(fp);
kom_info.kom_news_conf = fparse_long(fp);
kom_info.motd_of_lyskom = fparse_long(fp);
break;
default:
restart_kom("init_cache(): 'I' record; unknown version\n");
}
if (pers_pres_conf != -1)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment