You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 4797 Reporter:@avsm Assigned to: meyer Status: closed (set by @xavierleroy on 2015-12-11T18:24:07Z) Resolution: fixed Priority: normal Severity: minor Version: 3.11.0 Target version: 4.01.0+dev Category: ~DO NOT USE (was: OCaml general) Monitored by: mehdi "Richard Jones"
Bug description
We have a patch in the OpenBSD OCaml port to use mkstemp(3) instead of mktemp(3), to avoid insecure temporary file creation. mkstemp(3) is fairly widespread these days. but our patch is guarded by a #define(OPENBSD) which probably needs to be replaced with something better.
Original bug ID: 4797
Reporter: @avsm
Assigned to: meyer
Status: closed (set by @xavierleroy on 2015-12-11T18:24:07Z)
Resolution: fixed
Priority: normal
Severity: minor
Version: 3.11.0
Target version: 4.01.0+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: mehdi "Richard Jones"
Bug description
We have a patch in the OpenBSD OCaml port to use mkstemp(3) instead of mktemp(3), to avoid insecure temporary file creation. mkstemp(3) is fairly widespread these days. but our patch is guarded by a #define(OPENBSD) which probably needs to be replaced with something better.
http://www.openbsd.org/cgi-bin/cvsweb/ports/lang/ocaml/patches/patch-yacc_main_c?rev=1.5
--- yacc/main.c.orig Mon Jan 23 17:38:43 2006
+++ yacc/main.c Tue May 2 11:34:56 2006
@@ -55,6 +55,14 @@ char *text_file_name;
char *union_file_name;
char *verbose_file_name;
+#if defined(OpenBSD)
+#define HAVE_MKSTEMP
+#endif
+
+#ifdef HAVE_MKSTEMP
+int action_fd = -1, entry_fd = -1, text_fd = -1, union_fd = -1;
+#endif
+
FILE action_file; / a temp file, used to save actions associated /
/ with rules until the parser is written */
FILE *entry_file;
@@ -93,16 +101,29 @@ char *rassoc;
short **derives;
char *nullable;
+#if !defined(HAVE_MKSTEMP)
extern char *mktemp(char *);
+#endif
extern char *getenv(const char *);
void done(int k)
{
+#ifdef HAVE_MKSTEMP
+#else
if (action_file) { fclose(action_file); unlink(action_file_name); }
if (entry_file) { fclose(entry_file); unlink(entry_file_name); }
if (text_file) { fclose(text_file); unlink(text_file_name); }
if (union_file) { fclose(union_file); unlink(union_file_name); }
+#endif
if (output_file && k > 0) {
fclose(output_file); unlink(output_file_name);
}
@@ -302,11 +323,26 @@ void create_file_names(void)
union_file_name[len + 5] = 'u';
#ifndef NO_UNIX
+#ifdef HAVE_MKSTEMP
+#else
mktemp(action_file_name);
mktemp(entry_file_name);
mktemp(text_file_name);
mktemp(union_file_name);
#endif
+#endif
@@ -347,15 +383,27 @@ void open_files(void)
open_error(input_file_name);
}
+#ifdef HAVE_MKSTEMP
+#else
action_file = fopen(action_file_name, "w");
+#endif
if (action_file == 0)
open_error(action_file_name);
+#ifdef HAVE_MKSTEMP
+#else
entry_file = fopen(entry_file_name, "w");
+#endif
if (entry_file == 0)
open_error(entry_file_name);
+#ifdef HAVE_MKSTEMP
+#else
text_file = fopen(text_file_name, "w");
+#endif
if (text_file == 0)
open_error(text_file_name);
@@ -371,7 +419,11 @@ void open_files(void)
defines_file = fopen(defines_file_name, "w");
if (defines_file == 0)
open_error(defines_file_name);
+#ifdef HAVE_MKSTEMP
+#else
union_file = fopen(union_file_name, "w");
+#endif
if (union_file == 0)
open_error(union_file_name);
}
The text was updated successfully, but these errors were encountered: