bones file diagnostics
Pat added some error information to create_levelfile. This does the same for create_bonesfile, but the only place it is logged is in the paniclog, unless you're in wizard mode. If bones file creation is silently failing for someone and they aren't getting bones files, this provides a way to diagnose why.
This commit is contained in:
@@ -609,7 +609,7 @@ E int FDECL(create_levelfile, (int,char *));
|
||||
E int FDECL(open_levelfile, (int,char *));
|
||||
E void FDECL(delete_levelfile, (int));
|
||||
E void NDECL(clearlocks);
|
||||
E int FDECL(create_bonesfile, (d_level*,char **));
|
||||
E int FDECL(create_bonesfile, (d_level*,char **, char *));
|
||||
#ifdef MFLOPPY
|
||||
E void NDECL(cancel_bonesfile);
|
||||
#endif
|
||||
|
||||
@@ -194,6 +194,7 @@ struct obj *corpse;
|
||||
struct permonst *mptr;
|
||||
struct fruit *f;
|
||||
char c, *bonesid;
|
||||
char whynot[BUFSZ];
|
||||
|
||||
/* caller has already checked `can_make_bones()' */
|
||||
|
||||
@@ -308,12 +309,16 @@ struct obj *corpse;
|
||||
levl[x][y].glyph = cmap_to_glyph(S_stone);
|
||||
}
|
||||
|
||||
fd = create_bonesfile(&u.uz, &bonesid);
|
||||
fd = create_bonesfile(&u.uz, &bonesid, whynot);
|
||||
if(fd < 0) {
|
||||
#ifdef WIZARD
|
||||
if(wizard)
|
||||
pline("Cannot create bones file - create failed");
|
||||
pline("%s", whynot);
|
||||
#endif
|
||||
/* bones file creation problems are silent to the player.
|
||||
* Keep it that way, but place a clue into the paniclog.
|
||||
*/
|
||||
paniclog("savebones", whynot);
|
||||
return;
|
||||
}
|
||||
c = (char) (strlen(bonesid) + 1);
|
||||
|
||||
11
src/files.c
11
src/files.c
@@ -633,13 +633,15 @@ set_bonestemp_name()
|
||||
}
|
||||
|
||||
int
|
||||
create_bonesfile(lev, bonesid)
|
||||
create_bonesfile(lev, bonesid, errbuf)
|
||||
d_level *lev;
|
||||
char **bonesid;
|
||||
char errbuf[];
|
||||
{
|
||||
const char *file;
|
||||
int fd;
|
||||
|
||||
if (errbuf) *errbuf = '\0';
|
||||
*bonesid = set_bonesfile_name(bones, lev);
|
||||
file = set_bonestemp_name();
|
||||
file = fqname(file, BONESPREFIX, 0);
|
||||
@@ -655,6 +657,12 @@ char **bonesid;
|
||||
# else
|
||||
fd = creat(file, FCMASK);
|
||||
# endif
|
||||
#endif
|
||||
if (fd < 0 && errbuf) /* failure explanation */
|
||||
Sprintf(errbuf,
|
||||
"Cannot create bones \"%s\", id %s (errno %d).",
|
||||
lock, *bonesid, errno);
|
||||
|
||||
# if defined(VMS) && !defined(SECURE)
|
||||
/*
|
||||
Re-protect bones file with world:read+write+execute+delete access.
|
||||
@@ -666,7 +674,6 @@ char **bonesid;
|
||||
*/
|
||||
(void) chmod(file, FCMASK | 007); /* allow other users full access */
|
||||
# endif /* VMS && !SECURE */
|
||||
#endif /* MICRO || WIN32*/
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user