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
|
@ -1,3 +1,15 @@
|
|||
Mon Sep 18 16:35:45 CEST 2000 Werner Koch <wk@openit.de>
|
||||
|
||||
* strgutil.c (utf8_to_native): Fixed null ptr problem. By
|
||||
Giampaolo Tomassoni.
|
||||
|
||||
* iobuf.c: Use fopen64 insead of fopen when available.
|
||||
(iobuf_get_filelength): Use fstat64 when available but return
|
||||
2^32-1 if the file is larger than this value.
|
||||
|
||||
* miscutil.c (answer_is_yes_no_quit): Swapped order of yes/no test
|
||||
so that no is returned for an empty input. By David Champion.
|
||||
|
||||
Fri Aug 18 14:27:14 CEST 2000 Werner Koch <wk@openit.de>
|
||||
|
||||
* logger.c (log_set_file): Allow to set the file by name.
|
||||
|
|
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;
|
||||
}
|
||||
|
|
|
@ -311,16 +311,16 @@ answer_is_yes_no_quit( const char *s )
|
|||
char *short_no = _("nN");
|
||||
char *short_quit = _("qQ");
|
||||
|
||||
if( !stricmp(s, long_yes ) )
|
||||
return 1;
|
||||
if( !stricmp(s, long_no ) )
|
||||
return 0;
|
||||
if( !stricmp(s, long_yes ) )
|
||||
return 1;
|
||||
if( !stricmp(s, long_quit ) )
|
||||
return -1;
|
||||
if( strchr( short_yes, *s ) && !s[1] )
|
||||
return 1;
|
||||
if( strchr( short_no, *s ) && !s[1] )
|
||||
return 0;
|
||||
if( strchr( short_yes, *s ) && !s[1] )
|
||||
return 1;
|
||||
if( strchr( short_quit, *s ) && !s[1] )
|
||||
return -1;
|
||||
if( !stricmp(s, "yes" ) )
|
||||
|
|
|
@ -389,7 +389,8 @@ utf8_to_native( const char *string, size_t length )
|
|||
case 0 : n++; if( p ) *p++ = '0'; break;
|
||||
default: n += 3;
|
||||
sprintf( p, "x%02x", *s );
|
||||
p += 3;
|
||||
if ( p )
|
||||
p += 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -496,3 +497,7 @@ utf8_to_native( const char *string, size_t length )
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue