diff --git a/src/bind_eressea.c b/src/bind_eressea.c index 4d3918899..f76d0a903 100755 --- a/src/bind_eressea.c +++ b/src/bind_eressea.c @@ -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) { diff --git a/src/kernel/db/sqlite.c b/src/kernel/db/sqlite.c index fd9d0bc67..cc331b551 100644 --- a/src/kernel/db/sqlite.c +++ b/src/kernel/db/sqlite.c @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -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; + } } } }