fcache_init();
/* Read flagfile before main database */
- f = db_open(flag_file);
-
- if(f) {
- if(setjmp(db_err) == 0){
- use_flagfile = 1;
- do_rawlog(LT_ERR, "LOADING: %s", flag_file);
- if(load_flag_db(f) != 0)
- use_flagfile = 0;
- do_rawlog(LT_ERR, "LOADING: %s(done)", flag_file);
- penn_fclose(f);
- }
- } else use_flagfile = 0;
+
+ if(setjmp(db_err) == 1){
+ do_rawlog(LT_ERR, "DB: Could not process flag file. Will Attempt reading from main database.");
+ use_flagfile = 0;
+ } else {
+ f = db_open(flag_file);
+ use_flagfile = 1;
+ do_rawlog(LT_ERR, "LOADING: %s", flag_file);
+ if(load_flag_db(f) != 0)
+ use_flagfile = 0;
+ do_rawlog(LT_ERR, "LOADING: %s(done)", flag_file);
+ penn_fclose(f);
+ }
if(ps_tab._Read_Powers_ == 0)
init_powers();
- f = db_open(infile);
-
- if (!f) {
- do_rawlog(LT_ERR, "Couldn't open %s! Creating minimal world.", infile);
- init_compress(NULL);
- create_minimal_db();
- return 0;
- }
-
- c = penn_fgetc(f);
- if (c == EOF) {
- do_rawlog(LT_ERR, "Couldn't read %s! Creating minimal world.", infile);
- init_compress(NULL);
- create_minimal_db();
- return 0;
+ if (setjmp(db_err) == 1) {
+ do_rawlog(LT_ERR, "Couldn't open %s! Creating minimal world.", infile);
+ init_compress(NULL);
+ create_minimal_db();
+ return 0;
+ } else {
+ f = db_open(infile);
+ c = penn_fgetc(f);
+ if (c == EOF) {
+ do_rawlog(LT_ERR, "Couldn't read %s! Creating minimal world.", infile);
+ init_compress(NULL);
+ create_minimal_db();
+ return 0;
+ }
+ c = penn_fgetc(f);
}
- penn_ungetc(c, f);
-
if (setjmp(db_err) == 0) {
/* ok, read it in */
do_rawlog(LT_ERR, "ANALYZING: %s", infile);
penn_fclose(f);
panicdb = 0;
}
- } else /* Close the panicdb file handle */
- penn_fclose(f);
+ }
if (!panicdb) {
f = db_open(mailfile);
}
penn_fclose(f);
}
- }
+ } else /* Close the panicdb file handle */
+ penn_fclose(f);
#endif /* CHAT_SYSTEM */
} else {
do_rawlog(LT_ERR, "ERROR READING DATABASE!");
pf->type = PFT_GZFILE;
pf->handle.g = gzopen(filename, "rb");
if (!pf->handle.g) {
+ do_rawlog(LT_ERR, "Unable to open %s with libz: %s\n", filename, strerror(errno));
mush_free(pf, "pennfile");
longjmp(db_err, 1);
}
{
pf->type = PFT_FILE;
pf->handle.f = fopen(filename, FOPEN_READ);
+ if(!pf->handle.f)
+ do_rawlog(LT_ERR, "Unable to open %s: %s\n", filename, strerror(errno));
#ifdef HAVE_POSIX_FADVISE
- if (pf->handle.f)
+ else if (pf->handle.f)
posix_fadvise(fileno(pf->handle.f), 0, 0, POSIX_FADV_SEQUENTIAL);
#endif
{
pf->type = PFT_FILE;
pf->handle.f = fopen(filename, "wb");
+ if (!pf->handle.f)
+ do_rawlog(LT_ERR, "Unable to open %s: %s\n", filename, strerror(errno));
}
if (!pf->handle.f) {
mush_free(pf, "pennfile");