--- src/user.c.orig	Mon May 25 07:16:07 1998
+++ src/user.c	Tue Apr 25 19:13:52 2000
@@ -497,13 +497,24 @@ void execute_menu_command (char *s)
     int do_quote;
     char prompt [80] = "";
     int  col;
+#ifdef __OpenBSD__
+    char *file_name;
+#else
     char *file_name = tmpnam (0);
+#endif
 
 #ifdef OS2_NT
     /* OS/2 and NT requires the command to end in .cmd */
     file_name = copy_strings (file_name, ".cmd", NULL);
 #endif
+#ifdef __OpenBSD__
+#define TEMPFILE	"/tmp/mcXXXXXXXXXX"
+    file_name = xmalloc (sizeof(TEMPFILE), TEMPFILE);
+    strcpy (file_name, TEMPFILE);
+    if ((cmd_file_fd = mkstemp (file_name)) == -1) {
+#else
     if ((cmd_file_fd = open (file_name, O_RDWR | O_CREAT | O_TRUNC | O_EXCL, 0600)) == -1){
+#endif
 	message (1, MSG_ERROR, _(" Can't create temporary command file \n %s "),
 		 unix_error_string (errno));
 	return;
@@ -513,6 +524,9 @@ void execute_menu_command (char *s)
     if (!commands){
 	fclose (cmd_file);
 	unlink (file_name);
+#ifdef __OpenBSD__
+       free (file_name);
+#endif
 	return;
     }
     commands++;
@@ -536,6 +550,9 @@ void execute_menu_command (char *s)
 		    /* User canceled */
 		    fclose (cmd_file);
 		    unlink (file_name);
+#ifdef __OpenBSD__
+		    free (file_name);
+#endif
 		    return;
 		}
 		if (do_quote) {
@@ -579,6 +596,9 @@ void execute_menu_command (char *s)
     chmod (file_name, S_IRWXU);
     execute (file_name);
     unlink (file_name);
+#ifdef __OpenBSD__
+    free (file_name);
+#endif
 }
 
 /* 
