summaryrefslogtreecommitdiff
path: root/src/tools/lcc
diff options
context:
space:
mode:
authorZack Middleton <zturtleman@gmail.com>2015-01-07 18:16:27 -0600
committerTim Angus <tim@ngus.net>2015-03-17 11:39:12 +0000
commitf8ad4bb13a4c24d65b46491674819947de3c174b (patch)
tree947a9472af85be78b3d19a59dd874c8d1f6ca410 /src/tools/lcc
parentc1ed800486473996d55768c99d2aed96ed6fd797 (diff)
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.
Diffstat (limited to 'src/tools/lcc')
-rw-r--r--src/tools/lcc/cpp/unix.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/tools/lcc/cpp/unix.c b/src/tools/lcc/cpp/unix.c
index bd879448..3e70b562 100644
--- a/src/tools/lcc/cpp/unix.c
+++ b/src/tools/lcc/cpp/unix.c
@@ -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);