Commit 44b5ef9a authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(datafilename): Removed. All users modified to use

	param.datafile_name instead.
(backupfilename): Removed.  All users modified to use
	param.backupfile_name instead.
(textfilename): Removed.  All users modified to use
	param.textfile_name instead.
parent 5774037f
/*
* $Id: simple-cache.c,v 0.49 1994/12/31 12:03:15 ceder Exp $
* $Id: simple-cache.c,v 0.50 1995/10/07 14:39:06 ceder Exp $
* Copyright (C) 1991, 1992, 1993, 1994 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -33,7 +33,7 @@
* New save algorithm by ceder.
*/
static char *rcsid = "$Id: simple-cache.c,v 0.49 1994/12/31 12:03:15 ceder Exp $";
static char *rcsid = "$Id: simple-cache.c,v 0.50 1995/10/07 14:39:06 ceder Exp $";
#include "rcs.h"
USE(rcsid);
......@@ -98,11 +98,6 @@ static int next_free_num = 1;
static Cache_node_mcb * text_mcb;
static int next_text_num = 1;
/* Defined in ramkomd.c */
extern char datafilename[BUFSIZ];
extern char backupfilename[BUFSIZ];
extern char textfilename[BUFSIZ];
/*
* The elements in the following lists with same index refers to the same
* conference.
......@@ -1441,9 +1436,9 @@ pre_sync(void)
/* All marking is done. Now open file B. */
if ( is_clean(datafilename) )
if (is_clean(param.datafile_name))
{
if ( rename(datafilename, backupfilename) != 0 )
if (rename(param.datafile_name, param.backupfile_name) != 0)
restart_kom("pre_sync: can't backup.\n");
}
else
......@@ -1455,7 +1450,7 @@ pre_sync(void)
fclose(file_b);
}
if ( (file_b=fopen(datafilename, "wb") ) == NULL )
if ( (file_b=fopen(param.datafile_name, "wb") ) == NULL )
{
log("WARNING: pre_sync: can't open file to save in.\n");
sync_state = sync_wait;
......@@ -1630,7 +1625,7 @@ post_sync(void)
else
fclose(file_a);
if ( ( file_a = fopen(datafilename, "rb") ) == NULL )
if ( ( file_a = fopen(param.datafile_name, "rb") ) == NULL )
{
log("post_sync: can't open the file I just saved.\n");
sync_state = sync_wait;
......@@ -1780,16 +1775,16 @@ save_one_text(void)
file_b = NULL;
log("Sync: fclose() failed in save_one_text. Retrying.\n");
remove(datafilename);
remove(param.datafile_name);
sync_state = sync_wait;
return;
}
file_b = fopen(datafilename, "rb");
file_b = fopen(param.datafile_name, "rb");
if (file_b == NULL)
{
log("save_one_text(): failed to reopen file.\n");
remove (datafilename);
remove (param.datafile_name);
sync_state = sync_wait;
return;
}
......@@ -1893,7 +1888,7 @@ sync_part(void)
log("sync: Error saving new file. Retrying.\n");
fclose(file_b);
file_b = NULL;
remove(datafilename);
remove(param.datafile_name);
sync_state = sync_wait;
break;
......@@ -1957,25 +1952,25 @@ init_cache(void)
#endif
LOGACC(lt_restart, time(NULL));
if ( (text_file = fopen(textfilename, "a+b")) == NULL )
if ( (text_file = fopen(param.textfile_name, "a+b")) == NULL )
{
restart_kom("%s \"%s\". errno = %d\n",
"ERROR: init_cache: can't open text file",
textfilename, errno);
param.textfile_name, errno);
}
if ( is_clean(datafilename) )
if (is_clean(param.datafile_name))
{
if ( (file_a = fopen(datafilename, "rb")) == NULL )
if ((file_a = fopen(param.datafile_name, "rb")) == NULL)
{
log("WARNING: init_cache: can't open datafile.\n");
return FAILURE;
}
log("MSG: init_cache: using datafile.\n");
}
else if ( is_clean(backupfilename) )
else if (is_clean(param.backupfile_name))
{
if ( (file_a = fopen(backupfilename, "rb")) == NULL )
if ((file_a = fopen(param.backupfile_name, "rb")) == NULL)
{
log("WARNING: init_cache: can't open backupfile.\n");
return FAILURE;
......
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