Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 237833 Details for
Bug 326961
new ebuild for games-fps/wolf4sdl
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Alternative configname patch, with error checking
wolfsdl-configname.diff (text/plain), 1.94 KB, created by
Kevin Pyle
on 2010-07-07 02:43:42 UTC
(
hide
)
Description:
Alternative configname patch, with error checking
Filename:
MIME Type:
Creator:
Kevin Pyle
Created:
2010-07-07 02:43:42 UTC
Size:
1.94 KB
patch
obsolete
>diff --git a/wl_def.h b/wl_def.h >index 48007f5..0971507 100644 >--- a/wl_def.h >+++ b/wl_def.h >@@ -915,7 +915,7 @@ extern unsigned screenofs; > > extern boolean startgame; > extern char str[80]; >-extern char configname[13]; >+extern char configname[128]; > > // > // Command line parameter variables >diff --git a/wl_main.cpp b/wl_main.cpp >index dca0e89..6918213 100644 >--- a/wl_main.cpp >+++ b/wl_main.cpp >@@ -73,7 +73,7 @@ boolean startgame; > boolean loadedgame; > int mouseadjustment; > >-char configname[13]="config."; >+char configname[128]; > > // > // Command line parameter variables >diff --git a/wl_menu.cpp b/wl_menu.cpp >index 5591803..b25249c 100644 >--- a/wl_menu.cpp >+++ b/wl_menu.cpp >@@ -14,6 +14,8 @@ > #endif > > #include "wl_def.h" >+#include <string> >+#include <errno.h> > #pragma hdrstop > > extern int lastgamemusicoffset; >@@ -3982,6 +3984,41 @@ ShootSnd (void) > SD_PlaySound (SHOOTSND); > } > >+static void InitConfigname() >+{ >+ if (configname[0]) >+ /* already initialized */ >+ return; >+ const char *home = getenv("HOME"); >+ if (!home) >+ { >+ Quit("You must set $HOME."); >+ return; >+ } >+ std::string s = home; >+#define DOT_WOLF_DIR "/.wolf4sdl" >+#ifdef SPEAR >+#define CONFIG_BASENAME "/spear." >+#else >+#define CONFIG_BASENAME "/wolf3d." >+#endif >+ if (s.length() > sizeof(configname) - sizeof(DOT_WOLF_DIR) - sizeof(CONFIG_BASENAME)) >+ { >+ Quit("Your $HOME is too long."); >+ return; >+ } >+ s += DOT_WOLF_DIR; >+ errno = 0; >+ int r = mkdir(s.c_str(), 0755); >+ if (r != 0 && errno != EEXIST) >+ { >+ int e = errno; >+ Quit("Failed to mkdir %s: %s", s.c_str(), strerror(e)); >+ return; >+ } >+ s += CONFIG_BASENAME; >+ SDL_strlcpy(configname, s.c_str(), sizeof(configname)); >+} > > /////////////////////////////////////////////////////////////////////////// > // >@@ -3992,6 +4029,7 @@ void > CheckForEpisodes (void) > { > struct stat statbuf; >+ InitConfigname(); > > // > // JAPANESE VERSION
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 326961
:
237553
|
237555
|
237557
|
237559
|
237561
|
237565
|
237819
|
237821
|
237823
|
237825
| 237833 |
237849
|
237851
|
237853
|
237855
|
237857
|
237859
|
241169
|
288299