/*
- * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
#if !defined(OPENSSL_NO_STDIO)
# include <stdio.h>
+# ifdef _WIN32
+# include <windows.h>
+# endif
+# ifdef __DJGPP__
+# include <unistd.h>
+# endif
FILE *openssl_fopen(const char *filename, const char *mode)
{
{
char *newname = NULL;
- if (!HAS_LFN_SUPPORT(filename)) {
+ if (pathconf(filename, _PC_NAME_MAX) <= 12) { /* 8.3 file system? */
char *iterator;
char lastchar;
- newname = OPENSSL_malloc(strlen(filename) + 1);
- if (newname == NULL)
+ if ((newname = OPENSSL_malloc(strlen(filename) + 1)) == NULL) {
+ CRYPTOerr(CRYPTO_F_OPENSSL_FOPEN, ERR_R_MALLOC_FAILURE);
return NULL;
+ }
for (iterator = newname, lastchar = '\0';
*filename; filename++, iterator++) {