summaryrefslogtreecommitdiff
path: root/emulators/snes9x/files/patch-ak
blob: f91abc7d2a314a4a585fe1b9bf74ddb89e96ad50 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
--- server.cpp.orig	Fri Oct 13 18:57:43 2000
+++ server.cpp	Fri Oct 13 19:02:56 2000
@@ -940,11 +940,18 @@
 void S9xNPSyncClient (int client)
 {
     char fname [L_tmpnam];
+    int fd;
 
     S9xNPWaitForEmulationToComplete ();
 
+    int flen = snprintf(fname, sizeof(fname), "%s/snes9x.XXXXXX",
+      getenv("TMPDIR") ? getenv("TMPDIR") : P_tmpdir);
+    if (flen == -1 || flen >= sizeof(fname) || (fd = mkstemp(fname)) == -1)
+	return;
+    close(fd);
+
     S9xNPSetAction ("SERVER: Freezing game...", TRUE);
-    if (tmpnam (fname) && S9xFreezeGame (fname))
+    if (S9xFreezeGame (fname))
     {
         uint8 *data;
         uint32 len;