424f8e0a4e
byaccr is a parser generator for ruby based on 'Berkeley Yacc' and 'Berkeley Yacc for Java'.
70 lines
1.6 KiB
Text
70 lines
1.6 KiB
Text
$NetBSD: patch-ad,v 1.1.1.1 2001/07/01 14:39:15 taca Exp $
|
|
|
|
--- main.c.orig Thu Nov 2 01:29:07 2000
|
|
+++ main.c
|
|
@@ -307,9 +307,11 @@
|
|
text_file_name[len + 5] = 't';
|
|
union_file_name[len + 5] = 'u';
|
|
|
|
+#ifdef WITHOUT_MKSTEMP
|
|
mktemp(action_file_name);
|
|
mktemp(text_file_name);
|
|
mktemp(union_file_name);
|
|
+#endif
|
|
|
|
if (jflag)/*rwj*/
|
|
{
|
|
@@ -363,6 +365,9 @@
|
|
|
|
void open_files(void)
|
|
{
|
|
+#ifndef WITHOUT_MKSTEMP
|
|
+ int fd;
|
|
+#endif
|
|
create_file_names();
|
|
|
|
if (input_file == 0)
|
|
@@ -372,11 +377,25 @@
|
|
open_error(input_file_name);
|
|
}
|
|
|
|
- action_file = fopen(action_file_name, "w");
|
|
+#ifdef WITHOUT_MKSTEMP
|
|
+ action_file = fopen(action_file_name, "w+");
|
|
+#else
|
|
+ action_file = NULL;
|
|
+ fd = mkstemp(action_file_name);
|
|
+ if (fd >= 0)
|
|
+ action_file = fdopen(fd, "w");
|
|
+#endif
|
|
if (action_file == 0)
|
|
open_error(action_file_name);
|
|
|
|
- text_file = fopen(text_file_name, "w");
|
|
+#ifdef WITHOUT_MKSTEMP
|
|
+ text_file = fopen(text_file_name, "w+");
|
|
+#else
|
|
+ text_file = NULL;
|
|
+ fd = mkstemp(text_file_name);
|
|
+ if (fd >= 0)
|
|
+ action_file = fdopen(fd, "w");
|
|
+#endif
|
|
if (text_file == 0)
|
|
open_error(text_file_name);
|
|
|
|
@@ -392,7 +411,14 @@
|
|
defines_file = fopen(defines_file_name, "w");
|
|
if (defines_file == 0)
|
|
open_error(defines_file_name);
|
|
- union_file = fopen(union_file_name, "w");
|
|
+#ifdef WITHOUT_MKSTEMP
|
|
+ union_file = fopen(union_file_name, "w+");
|
|
+#else
|
|
+ union_file = NULL;
|
|
+ fd = mkstemp(union_file_name);
|
|
+ if (fd >= 0)
|
|
+ union_file = fdopen(fd, "w");
|
|
+#endif
|
|
if (union_file == 0)
|
|
open_error(union_file_name);
|
|
}
|