void-packages/srcpkgs/cdogs-sdl/patches/fix-segfault-on-start.patch

26 lines
740 B
Diff

--- src/cdogs/utils.c.orig 2016-03-06 09:56:53.000000000 +0100
+++ src/cdogs/utils.c 2016-03-15 13:52:14.404949301 +0100
@@ -308,12 +308,17 @@ void GetDataFilePath(char *buf, const ch
{
char relbuf[CDOGS_PATH_MAX];
char cwd[CDOGS_PATH_MAX];
- if (CDogsGetCWD(cwd) == NULL)
- {
- fprintf(stderr, "Error getting CWD; %s\n", strerror(errno));
- strcpy(cwd, "");
+ if(CDOGS_DATA_DIR[0] == '/') {
+ sprintf(relbuf, "%s%s", CDOGS_DATA_DIR, path);
+ }
+ else {
+ if (CDogsGetCWD(cwd) == NULL)
+ {
+ fprintf(stderr, "Error getting CWD; %s\n", strerror(errno));
+ strcpy(cwd, "");
+ }
+ sprintf(relbuf, "%s/%s%s", cwd, CDOGS_DATA_DIR, path);
}
- sprintf(relbuf, "%s/%s%s", cwd, CDOGS_DATA_DIR, path);
RealPath(relbuf, buf);
}