@@ -72,35 +72,12 @@ __CPROVER_HIDE:;
7272
7373void fclose_cleanup (void * stream );
7474__CPROVER_bool __VERIFIER_nondet___CPROVER_bool (void );
75+ FILE * fopen64 (const char * filename , const char * mode );
7576
7677FILE * fopen (const char * filename , const char * mode )
7778{
78- __CPROVER_HIDE :;
79- (void )* filename ;
80- (void )* mode ;
81- #ifdef __CPROVER_STRING_ABSTRACTION
82- __CPROVER_assert (__CPROVER_is_zero_string (filename ), "fopen zero-termination of 1st argument" );
83- __CPROVER_assert (__CPROVER_is_zero_string (mode ), "fopen zero-termination of 2nd argument" );
84- #endif
85-
86- FILE * fopen_result ;
87-
88- __CPROVER_bool fopen_error = __VERIFIER_nondet___CPROVER_bool ();
89-
90- #if !defined(__linux__ ) || defined(__GLIBC__ )
91- fopen_result = fopen_error ?NULL :malloc (sizeof (FILE ));
92- #else
93- // libraries need to expose the definition of FILE; this is the
94- // case for musl
95- fopen_result = fopen_error ?NULL :malloc (sizeof (int ));
96- #endif
97-
98- #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
99- __CPROVER_set_must (fopen_result , "open" );
100- __CPROVER_cleanup (fopen_result , fclose_cleanup );
101- #endif
102-
103- return fopen_result ;
79+ __CPROVER_HIDE :;
80+ return fopen64 (filename , mode );
10481}
10582
10683/* FUNCTION: _fopen */
@@ -152,14 +129,77 @@ __CPROVER_HIDE:;
152129}
153130#endif
154131
132+ /* FUNCTION: fopen64 */
133+
134+ #ifndef __CPROVER_STDIO_H_INCLUDED
135+ # include <stdio.h>
136+ # define __CPROVER_STDIO_H_INCLUDED
137+ #endif
138+
139+ #ifndef __CPROVER_STDLIB_H_INCLUDED
140+ # include <stdlib.h>
141+ # define __CPROVER_STDLIB_H_INCLUDED
142+ #endif
143+
144+ void fclose_cleanup (void * stream );
145+ __CPROVER_bool __VERIFIER_nondet___CPROVER_bool (void );
146+
147+ FILE * fopen64 (const char * filename , const char * mode )
148+ {
149+ __CPROVER_HIDE :;
150+ (void )* filename ;
151+ (void )* mode ;
152+ #ifdef __CPROVER_STRING_ABSTRACTION
153+ __CPROVER_assert (
154+ __CPROVER_is_zero_string (filename ),
155+ "fopen zero-termination of 1st argument" );
156+ __CPROVER_assert (
157+ __CPROVER_is_zero_string (mode ), "fopen zero-termination of 2nd argument" );
158+ #endif
159+
160+ FILE * fopen_result ;
161+
162+ __CPROVER_bool fopen_error = __VERIFIER_nondet___CPROVER_bool ();
163+
164+ #if !defined(__linux__ ) || defined(__GLIBC__ )
165+ fopen_result = fopen_error ? NULL : malloc (sizeof (FILE ));
166+ #else
167+ // libraries need to expose the definition of FILE; this is the
168+ // case for musl
169+ fopen_result = fopen_error ? NULL : malloc (sizeof (int ));
170+ #endif
171+
172+ #ifdef __CPROVER_CUSTOM_BITVECTOR_ANALYSIS
173+ __CPROVER_set_must (fopen_result , "open" );
174+ __CPROVER_cleanup (fopen_result , fclose_cleanup );
175+ #endif
176+
177+ return fopen_result ;
178+ }
179+
155180/* FUNCTION: freopen */
156181
157182#ifndef __CPROVER_STDIO_H_INCLUDED
158183#include <stdio.h>
159184#define __CPROVER_STDIO_H_INCLUDED
160185#endif
161186
187+ FILE * freopen64 (const char * filename , const char * mode , FILE * f );
188+
162189FILE * freopen (const char * filename , const char * mode , FILE * f )
190+ {
191+ __CPROVER_HIDE :;
192+ return freopen64 (filename , mode , f );
193+ }
194+
195+ /* FUNCTION: freopen64 */
196+
197+ #ifndef __CPROVER_STDIO_H_INCLUDED
198+ # include <stdio.h>
199+ # define __CPROVER_STDIO_H_INCLUDED
200+ #endif
201+
202+ FILE * freopen64 (const char * filename , const char * mode , FILE * f )
163203{
164204 __CPROVER_HIDE :;
165205 (void )* filename ;
0 commit comments