r293 - trunk/code/qcommon
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sun Nov 6 08:45:20 EST 2005
Author: ludwig
Date: 2005-11-06 08:45:20 -0500 (Sun, 06 Nov 2005)
New Revision: 293
Modified:
trunk/code/qcommon/common.c
Log:
- set umask to 0077 before writing the cdkey, the rest of the world
doesn't need to read it.
Modified: trunk/code/qcommon/common.c
===================================================================
--- trunk/code/qcommon/common.c 2005-11-06 07:56:36 UTC (rev 292)
+++ trunk/code/qcommon/common.c 2005-11-06 13:45:20 UTC (rev 293)
@@ -24,8 +24,9 @@
#include "q_shared.h"
#include "qcommon.h"
#include <setjmp.h>
-#if defined __linux__ || defined MACOS_X || defined __FreeBSD__ || defined __sun
+#ifndef _WIN32
#include <netinet/in.h>
+#include <sys/stat.h> // umask
#else
#include <winsock.h>
#endif
@@ -2312,6 +2313,9 @@
fileHandle_t f;
char fbuffer[MAX_OSPATH];
char key[17];
+#ifndef _WIN32
+ mode_t savedumask;
+#endif
sprintf(fbuffer, "%s/q3key", filename);
@@ -2323,10 +2327,13 @@
return;
}
+#ifndef _WIN32
+ savedumask = umask(0077);
+#endif
f = FS_SV_FOpenFileWrite( fbuffer );
if ( !f ) {
- Com_Printf ("Couldn't write %s.\n", filename );
- return;
+ Com_Printf ("Couldn't write CD key to %s.\n", fbuffer );
+ goto out;
}
FS_Write( key, 16, f );
@@ -2336,6 +2343,11 @@
FS_Printf( f, "// id Software and Activision will NOT ask you to send this file to them.\r\n");
FS_FCloseFile( f );
+out:
+#ifndef _WIN32
+ umask(savedumask);
+#endif
+ return;
}
#endif
More information about the quake3-commits
mailing list