pkgsrc/games/maelstrom-sdl/patches/patch-main.cpp
dholland c614b88159 Put the scorefile in ${VARBASE}/games instead of under ${PREFIX}/share.
It is still mode 666, which is wrong (XXX), but this way:
   - the package will actually install again;
   - the score file is not overwritten every time you recompile/reinstall.

There's also an .if 0 block in the makefile that can be turned on to
install the game setgid so the score file can be mode 664. I'm not
comfortable turning this on without doing at least a basic audit, and
I don't have energy for that at the moment; but it's there and it
works if anyone feels inclined to make that tradeoff locally.

An alternative approach would be to write and install a setgid
scorefile helper program, but that's not really any improvement over
making the scores world writeable

PKGREVISION -> 8.
2011-05-06 05:28:39 +00:00

26 lines
605 B
C++

$NetBSD: patch-main.cpp,v 1.1 2011/05/06 05:28:39 dholland Exp $
Support running setgid instead of installing the scores file mode 666.
--- main.cpp~ 2000-09-24 17:55:56.000000000 +0000
+++ main.cpp
@@ -163,10 +163,19 @@ void PrintUsage(void)
exit(1);
}
+#ifdef MAELSTROM_SETGID
+gid_t gamesgid;
+#endif
+
/* ----------------------------------------------------------------- */
/* -- Blitter main program */
int main(int argc, char *argv[])
{
+#ifdef MAELSTROM_SETGID
+ gamesgid = getegid();
+ setegid(getgid());
+#endif
+
/* Command line flags */
int doprinthigh = 0;
int speedtest = 0;