[Freeciv-Dev] (PR#10111) change file check in handle_single_want_hack_re
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] (PR#10111) change file check in handle_single_want_hack_req() |
From: |
"Mike Kaufman" <kaufman@xxxxxxxxxxxxxxxxxxxxxx> |
Date: |
Tue, 14 Sep 2004 15:21:38 -0700 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10111 >
if you're logging onto a server that's not local, you'll get these
messages every time telling you that you couldn't load or remove a
temporary file because it doesn't exist.
we change this to check if the file exists first.
-mike
Index: server/gamehand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/gamehand.c,v
retrieving revision 1.139
diff -u -r1.139 gamehand.c
--- server/gamehand.c 14 Sep 2004 03:29:22 -0000 1.139
+++ server/gamehand.c 14 Sep 2004 22:20:14 -0000
@@ -427,11 +427,22 @@
bool could_load = TRUE;
bool you_have_hack = FALSE;
- if (section_file_load_nodup(&file, challenge_filename)) {
- entropy = secfile_lookup_int_default(&file, 0, "challenge.entropy");
- section_file_free(&file);
+ if (is_reg_file_for_access(challenge_filename, FALSE)) {
+ if (section_file_load_nodup(&file, challenge_filename)) {
+ entropy = secfile_lookup_int_default(&file, 0, "challenge.entropy");
+ section_file_free(&file);
+ } else {
+ freelog(LOG_ERROR, "couldn't load temporary file: %s",
+ challenge_filename);
+ could_load = FALSE;
+ }
+
+ /* remove temp file */
+ if (remove(challenge_filename) != 0) {
+ freelog(LOG_ERROR, "couldn't remove temporary file: %s",
+ challenge_filename);
+ }
} else {
- freelog(LOG_ERROR, "couldn't load temporary file: %s", challenge_filename);
could_load = FALSE;
}
@@ -441,11 +452,5 @@
pc->access_level = ALLOW_HACK;
}
- /* remove temp file */
- if (remove(challenge_filename) != 0) {
- freelog(LOG_ERROR, "couldn't remove temporary file: %s",
- challenge_filename);
- }
-
dsend_packet_single_want_hack_reply(pc, you_have_hack);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#10111) change file check in handle_single_want_hack_req(),
Mike Kaufman <=
|
|