From 1a4d55f344a82e21a13578febe8f6e7e94a205db Mon Sep 17 00:00:00 2001 From: Dino Date: Mon, 5 Oct 2026 22:37:29 -0400 Subject: [PATCH] improve error message when secfile not found RM #2319 --- server/fcdb.c | 8 ++++++++ server/stdinhand.c | 15 ++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/server/fcdb.c b/server/fcdb.c index e9866a9b3e..9ad88315b7 100644 --- a/server/fcdb.c +++ b/server/fcdb.c @@ -121,9 +121,17 @@ static bool fcdb_load_config(const char *filename) { struct section_file *secfile; const char *val; + struct stat buf; fc_assert_ret_val(NULL != filename, FALSE); + /* does file exist? */ + if (fc_stat(filename, &buf) != 0) { + log_error(_("Cannot load fcdb config file '%s':\n%s"), filename, + fc_strerror(fc_get_errno())); + return FALSE; + } + if (!(secfile = secfile_load(filename, FALSE))) { log_error(_("Cannot load fcdb config file '%s':\n%s"), filename, secfile_error()); diff --git a/server/stdinhand.c b/server/stdinhand.c index 59c31388d3..a89b559fe5 100644 --- a/server/stdinhand.c +++ b/server/stdinhand.c @@ -3856,8 +3856,21 @@ bool load_command(struct connection *caller, const char *filename, bool check, } } - /* attempt to parse the file */ + { + struct stat buf; + + /* does file exist? */ + if (fc_stat(arg, &buf) != 0) { + log_error("Error loading savefile '%s': %s", arg, + fc_strerror(fc_get_errno())); + cmd_reply(CMD_LOAD, caller, C_FAIL, _("Could not load savefile: %s"), + arg); + dlsend_packet_game_load(game.est_connections, FALSE, arg); + return FALSE; + } + } + /* attempt to parse the file */ if (!(file = secfile_load(arg, FALSE))) { log_error("Error loading savefile '%s': %s", arg, secfile_error()); cmd_reply(CMD_LOAD, caller, C_FAIL, _("Could not load savefile: %s"), -- 2.31.0