Mapster32: fix construction of *_crash.map file name in crash handler.

git-svn-id: https://svn.eduke32.com/eduke32@3876 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2013-06-13 17:10:56 +00:00
parent 9c1eeae751
commit 51e021e810
2 changed files with 4 additions and 9 deletions

View file

@ -696,7 +696,7 @@ static inline char *Bstrncpyz(char *dst, const char *src, bsize_t n)
} }
// Append extension when <outbuf> contains no dot. // Append extension when <outbuf> contains no dot.
// <ext> should be like ".mhk", i.e. it MUST start with a dot. // <ext> can be like ".mhk" or like "_crash.map", no need to start with a dot.
// The ugly name is deliberate: we should be checking the sizes of all buffers! // The ugly name is deliberate: we should be checking the sizes of all buffers!
static inline void append_ext_UNSAFE(char *outbuf, const char *ext) static inline void append_ext_UNSAFE(char *outbuf, const char *ext)
{ {
@ -705,7 +705,7 @@ static inline void append_ext_UNSAFE(char *outbuf, const char *ext)
if (!p) if (!p)
Bstrcat(outbuf, ext); Bstrcat(outbuf, ext);
else else
Bstrcpy(p+1, ext+1); Bstrcpy(p, ext);
} }
#ifdef EXTERNC #ifdef EXTERNC

View file

@ -10512,13 +10512,8 @@ void app_crashhandler(void)
{ {
if (levelname[0]) if (levelname[0])
{ {
char *f = Bstrstr(levelname,".map"); append_ext_UNSAFE(levelname, "_crash.map");
SaveBoard(levelname, 1);
if (f)
Bstrcpy(f,"_crash.map");
else Bstrcat(f,"_crash.map");
SaveBoard(f, 1);
} }
} }