forked from github/server
fix CID 189401 and 189402
This commit is contained in:
parent
89d752bc1f
commit
c54ab6a3df
2 changed files with 11 additions and 2 deletions
|
@ -36,12 +36,16 @@ int eressea_write_game(const char * filename) {
|
|||
|
||||
int eressea_read_orders(const char * filename) {
|
||||
FILE * F = fopen(filename, "r");
|
||||
int result;
|
||||
|
||||
if (!F) {
|
||||
perror(filename);
|
||||
return -1;
|
||||
}
|
||||
log_info("reading orders from %s", filename);
|
||||
return parseorders(F);
|
||||
result = parseorders(F);
|
||||
fclose(F);
|
||||
return result;
|
||||
}
|
||||
|
||||
int eressea_export_json(const char * filename, int flags) {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <sqlite3.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
@ -213,7 +214,11 @@ void db_driver_close(database_t db)
|
|||
FILE * F = fopen(g_swapname, "r");
|
||||
if (F) {
|
||||
fclose(F);
|
||||
remove(g_swapname);
|
||||
if (0 != remove(g_swapname)) {
|
||||
log_error("could not remove %s: %s", g_swapname,
|
||||
strerror(errno));
|
||||
errno = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue