aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/bio/bss_file.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2016-05-10 14:41:19 +0200
committerRichard Levitte <levitte@openssl.org>2016-05-12 22:10:55 +0200
commit2c25ebd1e29a837b1c0e5fea5f464d4b6ddbab5a (patch)
tree1dcc46d581880394fbf16dd85e38e12eb115bcbc /crypto/bio/bss_file.c
parentae69c7d35351f9b1dcf42a21455e62d0ed5379e9 (diff)
downloadopenssl-2c25ebd1e29a837b1c0e5fea5f464d4b6ddbab5a.tar.gz
DJGPP adjustments
* Configure: Replaced -DTERMIO by -DTERMIOS in CFLAGS. * crypto/bio/bss_dgram.c [WATT32]: Remove obsolete redefinition of function names: sock_write, sock_read and sock_puts. * crypto/bio/bss_sock.c [WATT32]: For Watt-32 2.2.11 sock_write, sock_read and sock_puts are redefined to their private names so their names must be undefined first before they can be redefined again. * crypto/bio/bss_file.c (file_fopen) [__DJGPP__]: Make a copy of the passed file name and replace the leading dots in the dirname part and the basname part of the file name, unless LFN is supported. * e_os.h [__DJGPP__]: Undefine macro DEVRANDOM_EGD. Neither MS-DOS nor FreeDOS provide 'egd' sockets. New macro HAS_LFN_SUPPORT checks if underlying file system supports long file names or not. Include sys/un.h. Define WATT32_NO_OLDIES. * INSTALL.DJGPP: Update URL of WATT-32 library. Submitted by Juan Manuel Guerrero <juan.guerrero@gmx.de> RT#4217 Reviewed-by: Andy Polyakov <appro@openssl.org>
Diffstat (limited to 'crypto/bio/bss_file.c')
-rw-r--r--crypto/bio/bss_file.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/crypto/bio/bss_file.c b/crypto/bio/bss_file.c
index a37e89d935..3c056604c8 100644
--- a/crypto/bio/bss_file.c
+++ b/crypto/bio/bss_file.c
@@ -154,6 +154,36 @@ static FILE *file_fopen(const char *filename, const char *mode)
} else if (GetLastError() == ERROR_NO_UNICODE_TRANSLATION) {
file = fopen(filename, mode);
}
+# elif defined(__DJGPP__)
+ {
+ char *newname = NULL;
+
+ if (!HAS_LFN_SUPPORT(filename)) {
+ char *iterator;
+ char lastchar;
+
+ newname = OPENSSL_malloc(strlen(filename) + 1);
+ if (newname == NULL)
+ return NULL;
+
+ for(iterator = newname, lastchar = '\0';
+ *filename; filename++, iterator++) {
+ if (lastchar == '/' && filename[0] == '.'
+ && filename[1] != '.' && filename[1] != '/') {
+ /* Leading dots are not permitted in plain DOS. */
+ *iterator = '_';
+ } else {
+ *iterator = *filename;
+ }
+ lastchar = *filename;
+ }
+ *iterator = '\0';
+ filename = newname;
+ }
+ file = fopen(filename, mode);
+
+ OPENSSL_free(newname);
+ }
# else
file = fopen(filename, mode);
# endif