diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2014-04-16 19:42:25 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2014-04-16 19:42:25 +0000 |
commit | 585fce9ed1c996b8abdc47ebd21386923d3bb4ec (patch) | |
tree | 7f21a90cd736524f6777a526121bf7a3672edf28 /lib/libcrypto/bio/bss_file.c | |
parent | 3e1ee64e3b362b09b46274fcca4572b0881e1137 (diff) |
> As I walk through the valley of the shadow of death
> I take a look at my life and realize there's nothin' left
> Cause I've been blasting and laughing so long,
> That even my mama thinks that my mind is gone
Remove even more unspeakable evil being perpetuated in the name of VMS.
(and lesser evils done in the name of others.)
ok miod
Diffstat (limited to 'lib/libcrypto/bio/bss_file.c')
-rw-r--r-- | lib/libcrypto/bio/bss_file.c | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/lib/libcrypto/bio/bss_file.c b/lib/libcrypto/bio/bss_file.c index 982317b34a5..59e48e66590 100644 --- a/lib/libcrypto/bio/bss_file.c +++ b/lib/libcrypto/bio/bss_file.c @@ -89,10 +89,6 @@ #include "bio_lcl.h" #include <openssl/err.h> -#if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB) -#include <nwfileio.h> -#endif - #if !defined(OPENSSL_NO_STDIO) static int file_write(BIO *h, const char *buf, int num); @@ -122,46 +118,8 @@ BIO BIO *ret; FILE *file = NULL; -#if defined(_WIN32) && defined(CP_UTF8) - int sz, len_0 = (int)strlen(filename) + 1; - DWORD flags; - - /* - * Basically there are three cases to cover: a) filename is - * pure ASCII string; b) actual UTF-8 encoded string and - * c) locale-ized string, i.e. one containing 8-bit - * characters that are meaningful in current system locale. - * If filename is pure ASCII or real UTF-8 encoded string, - * MultiByteToWideChar succeeds and _wfopen works. If - * filename is locale-ized string, chances are that - * MultiByteToWideChar fails reporting - * ERROR_NO_UNICODE_TRANSLATION, in which case we fall - * back to fopen... - */ - if ((sz = MultiByteToWideChar(CP_UTF8,(flags = MB_ERR_INVALID_CHARS), - filename, len_0, NULL, 0)) > 0 || - (GetLastError() == ERROR_INVALID_FLAGS && - (sz = MultiByteToWideChar(CP_UTF8,(flags = 0), - filename, len_0, NULL, 0)) > 0)) { - WCHAR wmode[8]; - WCHAR *wfilename = _alloca(sz*sizeof(WCHAR)); - - if (MultiByteToWideChar(CP_UTF8, flags, filename, len_0, - wfilename, sz) && MultiByteToWideChar(CP_UTF8, 0, mode, - strlen(mode) + 1, wmode, - sizeof(wmode) / sizeof(wmode[0])) && - (file = _wfopen(wfilename, wmode)) == NULL && - (errno == ENOENT || errno == EBADF) - ) /* UTF - 8 decode succeeded, but no file, filename - * could still have been locale-ized... */ - file = fopen(filename, mode); - } else if (GetLastError() == ERROR_NO_UNICODE_TRANSLATION) { - file = fopen(filename, mode); - } -#else file = fopen(filename, mode); -#endif if (file == NULL) { SYSerr(SYS_F_FOPEN, errno); ERR_add_error_data(5, "fopen('", filename, "', '", mode, "')"); @@ -304,9 +262,6 @@ file_ctrl(BIO *b, int cmd, long num, void *ptr) b->ptr = ptr; b->init = 1; #if BIO_FLAGS_UPLINK!=0 -#if defined(__MINGW32__) && defined(__MSVCRT__) && !defined(_IOB_ENTRIES) -#define _IOB_ENTRIES 20 -#endif #if defined(_IOB_ENTRIES) /* Safety net to catch purely internal BIO_set_fp calls */ if ((size_t)ptr >= (size_t)stdin && @@ -317,37 +272,7 @@ file_ctrl(BIO *b, int cmd, long num, void *ptr) #ifdef UP_fsetmod if (b->flags&BIO_FLAGS_UPLINK) UP_fsetmod(b->ptr,(char)((num&BIO_FP_TEXT)?'t':'b')); - else #endif - { -#if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_CLIB) - int fd = fileno((FILE*)ptr); - /* Under CLib there are differences in file modes */ - if (num & BIO_FP_TEXT) - setmode(fd, O_TEXT); - else - setmode(fd, O_BINARY); -#elif defined(OPENSSL_SYS_MSDOS) - int fd = fileno((FILE*)ptr); - /* Set correct text/binary mode */ - if (num & BIO_FP_TEXT) - _setmode(fd, _O_TEXT); - /* Dangerous to set stdin/stdout to raw (unless redirected) */ - else { - if (fd == STDIN_FILENO || fd == STDOUT_FILENO) { - if (isatty(fd) <= 0) - _setmode(fd, _O_BINARY); - } else - _setmode(fd, _O_BINARY); - } -#elif defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_WIN32_CYGWIN) - int fd = fileno((FILE*)ptr); - if (num & BIO_FP_TEXT) - setmode(fd, O_TEXT); - else - setmode(fd, O_BINARY); -#endif - } break; case BIO_C_SET_FILENAME: file_free(b); @@ -367,18 +292,6 @@ file_ctrl(BIO *b, int cmd, long num, void *ptr) ret = 0; break; } -#if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_WIN32_CYGWIN) - if (!(num & BIO_FP_TEXT)) - strcat(p, "b"); - else - strcat(p, "t"); -#endif -#if defined(OPENSSL_SYS_NETWARE) - if (!(num & BIO_FP_TEXT)) - strcat(p, "b"); - else - strcat(p, "t"); -#endif fp = fopen(ptr, p); if (fp == NULL) { SYSerr(SYS_F_FOPEN, errno); |