From 197c8b8164569a24e512c1870bac9953e27f2abf Mon Sep 17 00:00:00 2001 From: Hourier Date: Tue, 28 Jan 2020 22:36:16 +0900 Subject: [PATCH] =?utf8?q?[Refactor]=20#37353=20=E4=BD=BF=E3=82=8F?= =?utf8?q?=E3=82=8C=E3=81=A6=E3=81=84=E3=81=AA=E3=81=84VERIFY=5FSAVEFILE?= =?utf8?q?=E3=82=92=E5=89=8A=E9=99=A4=20/=20Removed=20unused=20preprocesso?= =?utf8?q?rs=20VERIFY=5FSAVEFILE?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/core.c | 4 --- src/h-config.h | 11 -------- src/main.c | 14 ---------- src/save.c | 88 ---------------------------------------------------------- 4 files changed, 117 deletions(-) diff --git a/src/core.c b/src/core.c index 472656d5f..1d038c2a7 100644 --- a/src/core.c +++ b/src/core.c @@ -4128,8 +4128,6 @@ static void process_command(player_type *creature_ptr) break; } -#ifndef VERIFY_SAVEFILE - /* Hack -- Save and don't quit */ case KTRL('S'): { @@ -4137,8 +4135,6 @@ static void process_command(player_type *creature_ptr) break; } -#endif /* VERIFY_SAVEFILE */ - case KTRL('T'): { do_cmd_time(creature_ptr); diff --git a/src/h-config.h b/src/h-config.h index 00e2bd351..602ece100 100644 --- a/src/h-config.h +++ b/src/h-config.h @@ -234,16 +234,6 @@ # define SAFE_SETUID_POSIX #endif - -/* - * OPTION: Forbid the "savefile over-write" cheat, in which you simply - * run another copy of the game, loading a previously saved savefile, - * and let that copy over-write the "dead" savefile later. This option - * either locks the savefile, or creates a fake "xxx.lok" file to prevent - * the use of the savefile until the file is deleted. Not ready yet. - */ -/* #define VERIFY_SAVEFILE */ - /* * OPTION: Handle signals */ @@ -395,7 +385,6 @@ * React to the "VERIFY_HONOR" flag */ #ifdef VERIFY_HONOR -# define VERIFY_SAVEFILE #endif #ifndef HAVE_CONFIG_H diff --git a/src/main.c b/src/main.c index 401948014..4de68b332 100644 --- a/src/main.c +++ b/src/main.c @@ -196,18 +196,6 @@ static void change_path(concptr info) break; } -#ifdef VERIFY_SAVEFILE - - case 'b': - case 'd': - case 'e': - case 's': - { - quit_fmt("Restricted option '-d%s'", info); - } - -#else /* VERIFY_SAVEFILE */ - case 'b': { string_free(ANGBAND_DIR_BONE); @@ -243,8 +231,6 @@ static void change_path(concptr info) break; } -#endif /* VERIFY_SAVEFILE */ - default: { quit_fmt("Bad semantics in '-d%s'", info); diff --git a/src/save.c b/src/save.c index 631b2550d..62da068da 100644 --- a/src/save.c +++ b/src/save.c @@ -1533,24 +1533,6 @@ bool save_player(player_type *player_ptr) /* Hack -- Pretend the character was loaded */ current_world_ptr->character_loaded = TRUE; -#ifdef VERIFY_SAVEFILE - - /* Lock on savefile */ - strcpy(temp, savefile); - strcat(temp, ".lok"); - - /* Grab permissions */ - safe_setuid_grab(); - - /* Remove lock file */ - fd_kill(temp); - - /* Drop permissions */ - safe_setuid_drop(); - -#endif - - /* Success */ result = TRUE; } @@ -1618,45 +1600,6 @@ bool load_player(player_type *player_ptr) #endif errr err = 0; -#ifdef VERIFY_SAVEFILE - - /* Verify savefile usage */ - if (!err) - { - FILE *fkk; - - char temp[1024]; - - /* Extract name of lock file */ - strcpy(temp, savefile); - strcat(temp, ".lok"); - - /* Check for lock */ - fkk = my_fopen(temp, "r"); - - /* Oops, lock exists */ - if (fkk) - { - my_fclose(fkk); - - msg_print(_("セーブファイルは現在使用中です。", "Savefile is currently in use.")); - msg_print(NULL); - - return FALSE; - } - - /* Create a lock file */ - fkk = my_fopen(temp, "w"); - - /* Dump a line of info */ - fprintf(fkk, "Lock file for savefile '%s'\n", savefile); - - /* Close the lock file */ - my_fclose(fkk); - } - -#endif - int fd = -1; byte vvv[4]; if (!err) @@ -1764,23 +1707,6 @@ bool load_player(player_type *player_ptr) return TRUE; } -#ifdef VERIFY_SAVEFILE - - /* Verify savefile usage */ - if (TRUE) - { - char temp[1024]; - - /* Extract name of lock file */ - strcpy(temp, savefile); - strcat(temp, ".lok"); - - /* Remove lock */ - fd_kill(temp); - } - -#endif - msg_format(_("エラー(%s)がバージョン%d.%d.%d 用セーブファイル読み込み中に発生。", "Error (%s) reading %d.%d.%d savefile."), what, (current_world_ptr->z_major > 9) ? current_world_ptr->z_major - 10 : current_world_ptr->z_major, current_world_ptr->z_minor, current_world_ptr->z_patch); msg_print(NULL); @@ -1794,20 +1720,6 @@ bool load_player(player_type *player_ptr) */ void remove_loc(void) { -#ifdef VERIFY_SAVEFILE - char temp[1024]; -#endif /* VERIFY_SAVEFILE */ - -#ifdef VERIFY_SAVEFILE - - /* Lock on savefile */ - strcpy(temp, savefile); - strcat(temp, ".lok"); - - /* Remove lock file */ - fd_kill(temp); - -#endif /* VERIFY_SAVEFILE */ } -- 2.11.0