Группа :: Игры/Прочее
Пакет: shippy
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: shippy-1.5.0-shared-highscores.patch
Скачать
Скачать
diff -up shippy-1.5.0/shippy.c.orig shippy-1.5.0/shippy.c
--- shippy-1.5.0/shippy.c.orig 2019-05-20 12:51:22.408217300 +0200
+++ shippy-1.5.0/shippy.c 2019-05-20 12:52:43.500859257 +0200
@@ -1801,48 +1801,14 @@ int SHIPPY_MAIN(int argc, char *argv[])
{
int i;
#ifdef __unix__
- char *home = getenv("HOME");
- char *saveName = NULL;
- if (home)
- {
- int len = strlen(home);
- saveName = (char *)malloc(len + 100);
- strcpy(saveName, home);
- if (saveName[len - 1] != '/')
- {
- strcat(saveName, "/");
- }
- for (i = 0; i < 3; i++)
- {
- strcat(saveName, savePath[i]);
- int err = mkdir(saveName, 0700);
- if ((-1 == err) && (EEXIST != errno))
- {
- fprintf(stderr, "Error creating directory %s\n", saveName);
- exit(2);
- }
- strcat(saveName, "/");
- }
- }
- else
- {
- saveName = (char *)malloc(100);
- saveName[0] = 0;
- }
- strcat(saveName, "shippy.hs");
+ gid_t realgid;
+
+ highscore_fp = fopen("/var/lib/games/shippy.hs", "r+");
- highscore_fp = fopen(saveName, "r+");
- if (highscore_fp == NULL)
- {
- highscore_fp = fopen("/usr/share/shippy/shippy.hs", "r");
- RestoreHS();
- if (highscore_fp != NULL)
- {
- fclose(highscore_fp);
- }
- highscore_fp = fopen(saveName, "w+");
- StoreHS();
- rewind(highscore_fp);
+ realgid = getgid();
+ if (setresgid(-1, realgid, realgid) != 0) {
+ perror("Could not drop setgid privileges. Aborting.");
+ return 1;
}
#else
highscore_fp = fopen("data/scores.lst", "r+b");