diff srogue/save.c @ 120:d6b7c3fb37ea

srogue: add and use more md_* portable functions. Privileges and memory usage checks are now more portable.
author John "Elwin" Edwards
date Fri, 02 May 2014 15:06:23 -0700
parents 458df24e973d
children e6c8652473fe
line wrap: on
line diff
--- a/srogue/save.c	Wed Apr 30 14:46:30 2014 -0700
+++ b/srogue/save.c	Fri May 02 15:06:23 2014 -0700
@@ -26,10 +26,6 @@
 #include "rogue.h"
 #include "rogue.ext"
 
-#ifdef BSD
-#define srand48(seed)	srandom(seed)
-#endif
-
 EXTCHAR version[];
 EXTCHAR *ctime();
 
@@ -144,8 +140,7 @@
 	ignore();
 	if (!use_savedir)
 	{
-		setuid(playuid);
-		setgid(playgid);
+		md_resetpriv();
 	}
 	umask(022);
 
@@ -302,8 +297,7 @@
 				/* set id to unlink file */
 				if(pid == 0)
 				{
-					setuid(playuid);
-					setgid(playgid);
+					md_resetpriv();
 					unlink(file);
 					exit(0);
 				}
@@ -350,6 +344,6 @@
 	strcpy(file_name, file);
 	setup();
 	restscr(cw);
-	srand48(getpid());
+	srandom(getpid());
 	playit();
 }