mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
See ChangeLog: Mon Sep 18 16:35:45 CEST 2000 Werner Koch
This commit is contained in:
parent
c2fff8f204
commit
986d928ce2
46 changed files with 1780 additions and 852 deletions
29
util/iobuf.c
29
util/iobuf.c
|
@ -36,6 +36,14 @@
|
|||
#include "util.h"
|
||||
#include "iobuf.h"
|
||||
|
||||
|
||||
#if defined (HAVE_FOPEN64) && defined (HAVE_FSTAT64)
|
||||
#define fopen(a,b) fopen64 ((a),(b))
|
||||
#define fstat(a,b) fstat64 ((a),(b))
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
FILE *fp; /* open file handle */
|
||||
int print_only_name; /* flags indicating that fname is not a real file*/
|
||||
|
@ -1312,25 +1320,40 @@ iobuf_set_limit( IOBUF a, unsigned long nlimit )
|
|||
u32
|
||||
iobuf_get_filelength( IOBUF a )
|
||||
{
|
||||
#if defined (HAVE_FOPEN64) && defined (HAVE_FSTAT64)
|
||||
struct stat64 st;
|
||||
#else
|
||||
struct stat st;
|
||||
#endif
|
||||
|
||||
if( a->directfp ) {
|
||||
FILE *fp = a->directfp;
|
||||
|
||||
if( !fstat(fileno(fp), &st) )
|
||||
return st.st_size;
|
||||
if( !fstat(fileno(fp), &st) ) {
|
||||
#if defined (HAVE_FOPEN64) && defined (HAVE_FSTAT64)
|
||||
if( st.st_size >= IOBUF_FILELENGTH_LIMIT )
|
||||
return IOBUF_FILELENGTH_LIMIT;
|
||||
#endif
|
||||
return (u32)st.st_size;
|
||||
}
|
||||
log_error("fstat() failed: %s\n", strerror(errno) );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Hmmm: file_filter may have already been removed */
|
||||
for( ; a; a = a->chain )
|
||||
if( !a->chain && a->filter == file_filter ) {
|
||||
file_filter_ctx_t *b = a->filter_ov;
|
||||
FILE *fp = b->fp;
|
||||
|
||||
if( !fstat(fileno(fp), &st) )
|
||||
if( !fstat(fileno(fp), &st) ) {
|
||||
#if defined (HAVE_FOPEN64) && defined (HAVE_FSTAT64)
|
||||
if( st.st_size >= IOBUF_FILELENGTH_LIMIT )
|
||||
return IOBUF_FILELENGTH_LIMIT;
|
||||
#endif
|
||||
return st.st_size;
|
||||
}
|
||||
log_error("fstat() failed: %s\n", strerror(errno) );
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue