X-Git-Url: https://git.openssl.org/gitweb/?a=blobdiff_plain;f=crypto%2Fo_fopen.c;h=1090a0687691989497cced4699f112c84f6cb6da;hb=39df51522ba2e3773ae2f1d4df5a6031ef41c1ba;hp=a3a006574d70a15c4e0c76d8072643ccc8cbe6d9;hpb=e8aa8b6c8f6d4e2b2bbd5e5721d977b0a6aa3cee;p=openssl.git diff --git a/crypto/o_fopen.c b/crypto/o_fopen.c index a3a006574d..1090a06876 100644 --- a/crypto/o_fopen.c +++ b/crypto/o_fopen.c @@ -1,5 +1,5 @@ /* - * 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 @@ -12,6 +12,12 @@ #if !defined(OPENSSL_NO_STDIO) # include +# ifdef _WIN32 +# include +# endif +# ifdef __DJGPP__ +# include +# endif FILE *openssl_fopen(const char *filename, const char *mode) { @@ -61,13 +67,14 @@ 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++) {