forked from github/server
CID 22441 Unchecked return value from library
This commit is contained in:
parent
d6cd1feb48
commit
c090f8e1f4
1 changed files with 15 additions and 11 deletions
26
src/battle.c
26
src/battle.c
|
@ -3622,18 +3622,22 @@ battle *make_battle(region * r)
|
||||||
char zText[MAX_PATH];
|
char zText[MAX_PATH];
|
||||||
char zFilename[MAX_PATH];
|
char zFilename[MAX_PATH];
|
||||||
sprintf(zText, "%s/battles", basepath());
|
sprintf(zText, "%s/battles", basepath());
|
||||||
_mkdir(zText);
|
if (_mkdir(zText) != 0) {
|
||||||
sprintf(zFilename, "%s/battle-%d-%s.log", zText, obs_count, simplename(r));
|
log_error("could not create subdirectory for battle logs: %s", zText);
|
||||||
bdebug = fopen(zFilename, "w");
|
battledebug = false;
|
||||||
if (!bdebug)
|
}
|
||||||
log_error("battles cannot be debugged\n");
|
else {
|
||||||
else {
|
sprintf(zFilename, "%s/battle-%d-%s.log", zText, obs_count++, simplename(r));
|
||||||
const unsigned char utf8_bom[4] = { 0xef, 0xbb, 0xbf, 0 };
|
bdebug = fopen(zFilename, "w");
|
||||||
fwrite(utf8_bom, 1, 3, bdebug);
|
if (!bdebug)
|
||||||
fprintf(bdebug, "In %s findet ein Kampf statt:\n", rname(r,
|
log_error("battles cannot be debugged");
|
||||||
default_locale));
|
else {
|
||||||
|
const unsigned char utf8_bom[4] = { 0xef, 0xbb, 0xbf, 0 };
|
||||||
|
fwrite(utf8_bom, 1, 3, bdebug);
|
||||||
|
fprintf(bdebug, "In %s findet ein Kampf statt:\n", rname(r,
|
||||||
|
default_locale));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
obs_count++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
b->region = r;
|
b->region = r;
|
||||||
|
|
Loading…
Reference in a new issue