mirror of
https://github.com/ioquake/ioq3.git
synced 2024-11-10 07:11:46 +00:00
Use MSVC mode marcos for creat in q3cpp on Windows
Using unix mode 0666 for creat was causing crashes when compiled with MSVC. So use the marcos recommended by MSDN. MinGW also has the marcos, so apply to Windows builds in general.
This commit is contained in:
parent
aa1aad928e
commit
bd2af6e4ea
1 changed files with 7 additions and 1 deletions
|
@ -2,6 +2,7 @@
|
|||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include "cpp.h"
|
||||
|
||||
extern int lcc_getopt(int, char *const *, const char *);
|
||||
|
@ -66,7 +67,12 @@ setup(int argc, char **argv)
|
|||
error(FATAL, "Can't open input file %s", fp);
|
||||
}
|
||||
if (optind+1<argc) {
|
||||
int fdo = creat(argv[optind+1], 0666);
|
||||
int fdo;
|
||||
#ifdef WIN32
|
||||
fdo = creat(argv[optind+1], _S_IREAD | _S_IWRITE);
|
||||
#else
|
||||
fdo = creat(argv[optind+1], 0666);
|
||||
#endif
|
||||
if (fdo<0)
|
||||
error(FATAL, "Can't open output file %s", argv[optind+1]);
|
||||
dup2(fdo, 1);
|
||||
|
|
Loading…
Reference in a new issue