When open()ing 'file' in RAND_write_file, don't use O_EXCL.
authorBodo Möller <bodo@openssl.org>
Thu, 11 May 2000 23:10:27 +0000 (23:10 +0000)
committerBodo Möller <bodo@openssl.org>
Thu, 11 May 2000 23:10:27 +0000 (23:10 +0000)
This is superfluous now that we don't have to avoid creating
multiple versions of the file on VMS (because older versions
are now deleted).

crypto/rand/randfile.c

index 9ff3974cc7df25fa9e2a4ccb1c653ae2e73c6529..d01b9852e9473c4a45bdbd7283caf0f60769bff3 100644 (file)
@@ -134,18 +134,18 @@ int RAND_write_file(const char *file)
        FILE *out = NULL;
        int n;
        
-#if defined(O_CREAT) && defined(O_EXCL) && !defined(WIN32)
+#if defined(O_CREAT) && !defined(WIN32)
        /* For some reason Win32 can't write to files created this way */
-
-        /* chmod(..., 0600) is too late to protect the file,
-         * permissions should be restrictive from the start */
-        int fd = open(file, O_CREAT | O_EXCL, 0600);
-        if (fd != -1)
-                out = fdopen(fd, "wb");
+       
+       /* chmod(..., 0600) is too late to protect the file,
+        * permissions should be restrictive from the start */
+       int fd = open(file, O_CREAT, 0600);
+       if (fd != -1)
+               out = fdopen(fd, "wb");
 #endif
-        if (out == NULL)
-                out = fopen(file,"wb");
-        if (out == NULL) goto err;
+       if (out == NULL)
+               out = fopen(file,"wb");
+       if (out == NULL) goto err;
 
 #ifndef NO_CHMOD
        chmod(file,0600);