diff options
| author | djm <> | 2011-11-03 02:34:33 +0000 |
|---|---|---|
| committer | djm <> | 2011-11-03 02:34:33 +0000 |
| commit | fc7396568e61a510b9336d6c220aaa889c03060f (patch) | |
| tree | a8fc08e33aecdd21cb07aa47c8a3a9db715f2ef3 /src/lib/libcrypto/bio/bss_file.c | |
| parent | 1e8701dd2507fadf6d232d93eb4299a8b79c66d5 (diff) | |
| download | openbsd-fc7396568e61a510b9336d6c220aaa889c03060f.tar.gz openbsd-fc7396568e61a510b9336d6c220aaa889c03060f.tar.bz2 openbsd-fc7396568e61a510b9336d6c220aaa889c03060f.zip | |
openssl-1.0.0e: resolve conflicts
Diffstat (limited to 'src/lib/libcrypto/bio/bss_file.c')
| -rw-r--r-- | src/lib/libcrypto/bio/bss_file.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lib/libcrypto/bio/bss_file.c b/src/lib/libcrypto/bio/bss_file.c index 8bfa0bcd97..b954fe7ebc 100644 --- a/src/lib/libcrypto/bio/bss_file.c +++ b/src/lib/libcrypto/bio/bss_file.c | |||
| @@ -123,6 +123,7 @@ BIO *BIO_new_file(const char *filename, const char *mode) | |||
| 123 | 123 | ||
| 124 | #if defined(_WIN32) && defined(CP_UTF8) | 124 | #if defined(_WIN32) && defined(CP_UTF8) |
| 125 | int sz, len_0 = (int)strlen(filename)+1; | 125 | int sz, len_0 = (int)strlen(filename)+1; |
| 126 | DWORD flags; | ||
| 126 | 127 | ||
| 127 | /* | 128 | /* |
| 128 | * Basically there are three cases to cover: a) filename is | 129 | * Basically there are three cases to cover: a) filename is |
| @@ -136,17 +137,22 @@ BIO *BIO_new_file(const char *filename, const char *mode) | |||
| 136 | * ERROR_NO_UNICODE_TRANSLATION, in which case we fall | 137 | * ERROR_NO_UNICODE_TRANSLATION, in which case we fall |
| 137 | * back to fopen... | 138 | * back to fopen... |
| 138 | */ | 139 | */ |
| 139 | if ((sz=MultiByteToWideChar(CP_UTF8,MB_ERR_INVALID_CHARS, | 140 | if ((sz=MultiByteToWideChar(CP_UTF8,(flags=MB_ERR_INVALID_CHARS), |
| 141 | filename,len_0,NULL,0))>0 || | ||
| 142 | (GetLastError()==ERROR_INVALID_FLAGS && | ||
| 143 | (sz=MultiByteToWideChar(CP_UTF8,(flags=0), | ||
| 140 | filename,len_0,NULL,0))>0) | 144 | filename,len_0,NULL,0))>0) |
| 145 | ) | ||
| 141 | { | 146 | { |
| 142 | WCHAR wmode[8]; | 147 | WCHAR wmode[8]; |
| 143 | WCHAR *wfilename = _alloca(sz*sizeof(WCHAR)); | 148 | WCHAR *wfilename = _alloca(sz*sizeof(WCHAR)); |
| 144 | 149 | ||
| 145 | if (MultiByteToWideChar(CP_UTF8,MB_ERR_INVALID_CHARS, | 150 | if (MultiByteToWideChar(CP_UTF8,flags, |
| 146 | filename,len_0,wfilename,sz) && | 151 | filename,len_0,wfilename,sz) && |
| 147 | MultiByteToWideChar(CP_UTF8,0,mode,strlen(mode)+1, | 152 | MultiByteToWideChar(CP_UTF8,0,mode,strlen(mode)+1, |
| 148 | wmode,sizeof(wmode)/sizeof(wmode[0])) && | 153 | wmode,sizeof(wmode)/sizeof(wmode[0])) && |
| 149 | (file=_wfopen(wfilename,wmode))==NULL && errno==ENOENT | 154 | (file=_wfopen(wfilename,wmode))==NULL && |
| 155 | (errno==ENOENT || errno==EBADF) | ||
| 150 | ) /* UTF-8 decode succeeded, but no file, filename | 156 | ) /* UTF-8 decode succeeded, but no file, filename |
| 151 | * could still have been locale-ized... */ | 157 | * could still have been locale-ized... */ |
| 152 | file = fopen(filename,mode); | 158 | file = fopen(filename,mode); |
