Add a pointer to a paper (is the algorithm in section 4.2 the
[oweals/openssl.git] / crypto / bio / bss_file.c
index 3ed5dab90427c79349f105688f6af34d02390b50..52c0c39df045a0b303c33967fa43ae32b33527cc 100644 (file)
 #include <stdio.h>
 #include <errno.h>
 #include "cryptlib.h"
-#include "bio.h"
-#include "err.h"
+#include <openssl/bio.h>
+#include <openssl/err.h>
 
 #if !defined(NO_STDIO)
 
-#ifndef NOPROTO
 static int MS_CALLBACK file_write(BIO *h,char *buf,int num);
 static int MS_CALLBACK file_read(BIO *h,char *buf,int size);
 static int MS_CALLBACK file_puts(BIO *h,char *str);
@@ -81,16 +80,6 @@ static int MS_CALLBACK file_gets(BIO *h,char *str,int size);
 static long MS_CALLBACK file_ctrl(BIO *h,int cmd,long arg1,char *arg2);
 static int MS_CALLBACK file_new(BIO *h);
 static int MS_CALLBACK file_free(BIO *data);
-#else
-static int MS_CALLBACK file_write();
-static int MS_CALLBACK file_read();
-static int MS_CALLBACK file_puts();
-static int MS_CALLBACK file_gets();
-static long MS_CALLBACK file_ctrl();
-static int MS_CALLBACK file_new();
-static int MS_CALLBACK file_free();
-#endif
-
 static BIO_METHOD methods_filep=
        {
        BIO_TYPE_FILE,
@@ -104,7 +93,7 @@ static BIO_METHOD methods_filep=
        file_free,
        };
 
-BIO *BIO_new_file(char *filename, char *mode)
+BIO *BIO_new_file(const char *filename, const char *mode)
        {
        BIO *ret;
        FILE *file;
@@ -211,7 +200,7 @@ static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, char *ptr)
                break;
        case BIO_C_SET_FILE_PTR:
                file_free(b);
-               b->shutdown=(int)num;
+               b->shutdown=(int)num&BIO_CLOSE;
                b->ptr=(char *)ptr;
                b->init=1;
 #if defined(MSDOS) || defined(WINDOWS)