Commit 1b06e63f authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Improve logging and error messages.

* src/server/simple-cache.c (read_person): Use restart_kom instead
of kom_log when there is a size mismatch.
(read_conference): Ditto.
(pre_sync): Log the file name and error message when the file to
save in cannot be opened.
(init_cache): Improve the error message when the database is in
the wrong format.
parent d622ef86
2006-10-19 Per Cederqvist <ceder@lysator.liu.se> 2006-10-19 Per Cederqvist <ceder@lysator.liu.se>
   
Improve logging and error messages.
* src/server/simple-cache.c (read_person): Use restart_kom instead
of kom_log when there is a size mismatch.
(read_conference): Ditto.
(pre_sync): Log the file name and error message when the file to
save in cannot be opened.
(init_cache): Improve the error message when the database is in
the wrong format.
Fixed a missing opportunity to use foutput_newline. Fixed a missing opportunity to use foutput_newline.
* src/server/dbck-cache.c (cache_sync_all): Replaced another * src/server/dbck-cache.c (cache_sync_all): Replaced another
fprintf call with a call to foutput_newline. fprintf call with a call to foutput_newline.
......
...@@ -277,9 +277,9 @@ read_person(FILE *fp, ...@@ -277,9 +277,9 @@ read_person(FILE *fp,
} }
else if (new_pos != pos + size) else if (new_pos != pos + size)
{ {
kom_log("WARNING: Person %ld at %ld should be %ld bytes, " restart_kom("Person %ld at %ld should be %ld bytes, "
"but %ld bytes was read\n", "but %ld bytes was read\n",
pers_no, pos, size, new_pos - pos); pers_no, pos, size, new_pos - pos);
} }
return p; return p;
} }
...@@ -313,9 +313,9 @@ read_conference(FILE *fp, ...@@ -313,9 +313,9 @@ read_conference(FILE *fp,
} }
else if (new_pos != pos + size) else if (new_pos != pos + size)
{ {
kom_log("WARNING: Conference %ld at %ld should be %ld bytes, " restart_kom("Conference %ld at %ld should be %ld bytes, "
"but %ld bytes was read\n", "but %ld bytes was read\n",
conf_no, pos, size, new_pos - pos); conf_no, pos, size, new_pos - pos);
} }
return c; return c;
} }
...@@ -1923,7 +1923,8 @@ pre_sync(void) ...@@ -1923,7 +1923,8 @@ pre_sync(void)
if ((file_b = i_fopen(param.datafile_name, "wb")) == NULL) if ((file_b = i_fopen(param.datafile_name, "wb")) == NULL)
{ {
kom_log("WARNING: pre_sync: can't open file to save in.\n"); kom_log("WARNING: pre_sync: can't open file %s to save in: %s.\n",
param.datafile_name, strerror(errno));
sync_state = sync_wait; sync_state = sync_wait;
return; return;
...@@ -2711,10 +2712,7 @@ init_cache(void) ...@@ -2711,10 +2712,7 @@ init_cache(void)
switch (datafile_version) switch (datafile_version)
{ {
case 0: case 0:
restart_kom("Database is version 0. Please convert it with dbck.\n");
break;
case 1: case 1:
fseek(file_a, 12, SEEK_SET);
restart_kom("You need to run dbck to convert your datafile to version 2.\n"); restart_kom("You need to run dbck to convert your datafile to version 2.\n");
break; break;
case 2: case 2:
......
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