Skip to content
This repository was archived by the owner on Aug 24, 2025. It is now read-only.

Commit cc08075

Browse files
Andy Polyakovmattcaswell
authored andcommitted
crypto/o_fopen.c: alias fopen to fopen64.
Originally fopen(3) was called from bio/bss_file.c, which performed the aliasing. Then fopen(3) was moved to o_fopen.c, while "magic" definition was left behind. It's still useful on 32-bit platforms, so pull it to o_fopen.c. Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from openssl#6596) (cherry picked from commit 2369111)
1 parent 6114041 commit cc08075

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

crypto/o_fopen.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,24 @@
77
* https://www.openssl.org/source/license.html
88
*/
99

10+
# if defined(__linux) || defined(__sun) || defined(__hpux)
11+
/*
12+
* Following definition aliases fopen to fopen64 on above mentioned
13+
* platforms. This makes it possible to open and sequentially access files
14+
* larger than 2GB from 32-bit application. It does not allow to traverse
15+
* them beyond 2GB with fseek/ftell, but on the other hand *no* 32-bit
16+
* platform permits that, not with fseek/ftell. Not to mention that breaking
17+
* 2GB limit for seeking would require surgery to *our* API. But sequential
18+
* access suffices for practical cases when you can run into large files,
19+
* such as fingerprinting, so we can let API alone. For reference, the list
20+
* of 32-bit platforms which allow for sequential access of large files
21+
* without extra "magic" comprise *BSD, Darwin, IRIX...
22+
*/
23+
# ifndef _FILE_OFFSET_BITS
24+
# define _FILE_OFFSET_BITS 64
25+
# endif
26+
# endif
27+
1028
#include "internal/cryptlib.h"
1129

1230
#if !defined(OPENSSL_NO_STDIO)

0 commit comments

Comments
 (0)