summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Heaven <nyhm@gentoo.org>2010-07-08 13:13:07 +0000
committerTristan Heaven <nyhm@gentoo.org>2010-07-08 13:13:07 +0000
commit77050ad1b875f0d339603ece3fa2eec206f9efba (patch)
tree88a78f9871d18322c9240f847d95b32104a3a292 /games-arcade/epiar/files
parentVersion bump (diff)
downloadgentoo-2-77050ad1b875f0d339603ece3fa2eec206f9efba.tar.gz
gentoo-2-77050ad1b875f0d339603ece3fa2eec206f9efba.tar.bz2
gentoo-2-77050ad1b875f0d339603ece3fa2eec206f9efba.zip
Fix segfault caused by our patch, bug #326861
(Portage version: 2.2_rc67/cvs/Linux x86_64)
Diffstat (limited to 'games-arcade/epiar/files')
-rw-r--r--games-arcade/epiar/files/epiar-0.5-paths.patch86
1 files changed, 86 insertions, 0 deletions
diff --git a/games-arcade/epiar/files/epiar-0.5-paths.patch b/games-arcade/epiar/files/epiar-0.5-paths.patch
new file mode 100644
index 000000000000..41266c7272b1
--- /dev/null
+++ b/games-arcade/epiar/files/epiar-0.5-paths.patch
@@ -0,0 +1,86 @@
+--- src/input/input.c
++++ src/input/input.c
+@@ -240,7 +240,10 @@
+ *
+ ******************************************************************************/
+ int load_input_cfg(void) {
+- FILE *fp = fopen("./.epiar-input.ecf", "rb");
++ char filename[PATH_MAX];
++ FILE *fp;
++ snprintf(filename, sizeof(filename), "%s/.epiar-input.ecf", getenv("HOME"));
++ fp = fopen(filename, "rb");
+
+ /* make sure all keys are enabled */
+ unlock_keys();
+@@ -282,7 +285,7 @@
+ } else {
+ float file_version = 0.0f;
+ /* read the file into the struct */
+- fp = fopen("./.epiar-input.ecf", "rb");
++ fp = fopen(filename, "rb");
+
+ if (fp == NULL) {
+ fprintf(stdout, "Could not open \"./.epiar-input.ecf\" for reading, assuming default bindings.\n");
+@@ -472,10 +475,12 @@
+ }
+
+ void save_keybindings(void) {
++ char filename[PATH_MAX];
+ float file_version = 0.2f;
+ FILE *fp;
+
+- fp = fopen("./.epiar-input.ecf", "wb");
++ snprintf(filename, sizeof(filename), "%s/.epiar-input.ecf", getenv("HOME"));
++ fp = fopen(filename, "wb");
+ if (fp == NULL) {
+ fprintf(stdout, "Could not create '~/.epiar-input.ecf' to save keybindings\n");
+ return;
+--- src/main.c
++++ src/main.c
+@@ -16,7 +16,7 @@
+ unsigned char view_mode = 0;
+ int ship_to_follow = 0;
+ int desired_bpp = 16;
+-char *game_path;
++const char * const game_path = "GENTOO_DATADIR";
+ unsigned char use_ogl = 0;
+ unsigned char skip_intro = 0;
+ FILE *epiar_eaf = NULL, *main_eaf = NULL;
+@@ -78,8 +78,6 @@
+
+ parse_commandline(argc, argv);
+
+- get_absolute_path(argv[0]);
+-
+ init(desired_bpp);
+
+ menu();
+--- src/main.h
++++ src/main.h
+@@ -1,2 +1,2 @@
+ extern char epiar_version[6];
+-extern char *game_path;
++extern const char * const game_path;
+--- src/system/init.c
++++ src/system/init.c
+@@ -89,9 +89,6 @@
+ main_eaf = NULL;
+ }
+
+- assert(game_path != NULL);
+- free(game_path);
+- game_path = NULL;
+
+ if (average_loop_time == 0) average_loop_time = 18; /* in case they quit on menu */
+ #ifndef NDEBUG
+--- src/system/path.c
++++ src/system/path.c
+@@ -45,7 +45,7 @@
+ }
+ #endif
+
+-#ifdef LINUX
++#if 0
+ char *strip_path_of_binary(char *argv) {
+ int len = 0, i, blen = 0;
+ char *stripped = NULL;