Oops, it's probably a good idea to actually remember to add 'return
file;' at the end of the new function as I had intended, not just rely
on the value being left in the appropriate register after the fopen()
call.

diff --git a/crypto/bio/bss_file.c b/crypto/bio/bss_file.c
index b954fe7..7765584 100644
--- a/crypto/bio/bss_file.c
+++ b/crypto/bio/bss_file.c
@@ -116,9 +116,8 @@ static BIO_METHOD methods_filep=
        NULL,
        };
 
-BIO *BIO_new_file(const char *filename, const char *mode)
-       {
-       BIO  *ret;
+static FILE *file_fopen(const char *filename, const char *mode)
+{
        FILE *file=NULL;
 
 #if defined(_WIN32) && defined(CP_UTF8)
@@ -164,6 +163,13 @@ BIO *BIO_new_file(const char *filename, const char *mode)
 #else
        file=fopen(filename,mode);      
 #endif
+       return file;
+}
+BIO *BIO_new_file(const char *filename, const char *mode)
+       {
+       BIO  *ret;
+       FILE *file=file_fopen(filename, mode);
+
        if (file == NULL)
                {
                SYSerr(SYS_F_FOPEN,get_last_sys_error());
@@ -392,7 +398,7 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long 
num, void *ptr)
                else
                        strcat(p,"t");
 #endif
-               fp=fopen(ptr,p);
+               fp=file_fopen(ptr,p);
                if (fp == NULL)
                        {
                        SYSerr(SYS_F_FOPEN,get_last_sys_error());

-- 
dwmw2

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to