From b4eac72f6d0794f0281c90fceee0f9dd8203ce6b Mon Sep 17 00:00:00 2001
From: kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue, 15 Jan 2002 14:34:56 +0000
Subject: [PATCH] 	* libiberty/mkstemps.c (mkstemps): On VMS, open temp
 file with option 	that causes it to be deleted when closed. 	*
 gcc/gcc.c (delete_if_ordinary): Backout previous change.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@48872 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog        | 8 +++++---
 gcc/gcc.c            | 4 +---
 libiberty/ChangeLog  | 5 +++++
 libiberty/mkstemps.c | 4 ++++
 4 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 70428b15078f..416146130862 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,10 +1,12 @@
-2002-01-15  Kazu Hirata  <kazu@hxi.com>
+2002-01-15  Douglas B Rupp  <rupp@gnat.com>
 
-	* confiig/h8300/h8300.c (print_operand): Remove support for
-	unused operand characters.
+	* gcc.c (delete_if_ordinary): Backout previous change.
 
 2002-01-15  Kazu Hirata  <kazu@hxi.com>
 
+	* config/h8300/h8300.c (print_operand): Remove support for
+	unused operand characters.
+
 	* read-rtl.c: Fix formatting.
 	* real.c: Likewise.
 	* recog.c: Likewise.
diff --git a/gcc/gcc.c b/gcc/gcc.c
index d5472d33ddf3..65ee5fab0eed 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -2110,9 +2110,7 @@ delete_if_ordinary (name)
 
   if (i == 'y' || i == 'Y')
 #endif /* DEBUG */
-    /* On VMS, more than one version of the temporary file may have been
-       created.  This ensures we delete all of them.  */
-    while (stat (name, &st) >= 0 && S_ISREG (st.st_mode))
+    if (stat (name, &st) >= 0 && S_ISREG (st.st_mode))
       if (unlink (name) < 0)
 	if (verbose_flag)
 	  perror_with_name (name);
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index fdccb59ab438..43a2951dae14 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,8 @@
+2002-01-15  Douglas B Rupp  <rupp@gnat.com>
+
+	* mkstemps.c (mkstemps): On VMS, open temp file with option
+	that causes it to be deleted when closed.
+
 2002-01-02  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
 	* cp-demangle.c (long_options): Const-ify.
diff --git a/libiberty/mkstemps.c b/libiberty/mkstemps.c
index 8fe5784f1897..1f6600a15b91 100644
--- a/libiberty/mkstemps.c
+++ b/libiberty/mkstemps.c
@@ -121,7 +121,11 @@ mkstemps (template, suffix_len)
       v /= 62;
       XXXXXX[5] = letters[v % 62];
 
+#ifdef VMS
+      fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600, "fop=tmd");
+#else
       fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600);
+#endif
       if (fd >= 0)
 	/* The file does not exist.  */
 	return fd;
-- 
GitLab