Bug #2403 ยป 0087-Check-that-savegame-to-load-is-a-regular-file.patch
| server/fcdb.c | ||
|---|---|---|
|
fc_assert_ret_val(filename != nullptr, FALSE);
|
||
|
/* does file exist? */
|
||
|
/* 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 (!S_ISREG(buf.st_mode)) {
|
||
|
log_error(_("Cannot load fcdb config file '%s':\n%s"), filename,
|
||
|
"not a file");
|
||
|
return FALSE;
|
||
|
}
|
||
|
if (!(secfile = secfile_load(filename, FALSE))) {
|
||
|
log_error(_("Cannot load fcdb config file '%s':\n%s"), filename,
|
||
| server/stdinhand.c | ||
|---|---|---|
|
{
|
||
|
struct stat buf;
|
||
|
bool failure = FALSE;
|
||
|
/* does file exist? */
|
||
|
/* Does file exist? */
|
||
|
if (fc_stat(arg, &buf) != 0) {
|
||
|
log_error("Error loading savefile '%s': %s", arg,
|
||
|
fc_strerror(fc_get_errno()));
|
||
|
failure = TRUE;
|
||
|
} else if (!S_ISREG(buf.st_mode)) {
|
||
|
log_error("Error loading savefile '%s': %s", arg,
|
||
|
"not a file");
|
||
|
failure = TRUE;
|
||
|
}
|
||
|
if (failure) {
|
||
|
cmd_reply(CMD_LOAD, caller, C_FAIL, _("Could not load savefile: %s"),
|
||
|
arg);
|
||
|
dlsend_packet_game_load(game.est_connections, FALSE, arg);
|
||