1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

bug fixes

This commit is contained in:
Werner Koch 1998-02-11 23:22:09 +00:00
parent 4c0c155922
commit bc5789665a
37 changed files with 949 additions and 137 deletions

View file

@ -221,10 +221,10 @@ optfile_parse( FILE *fp, const char *filename, unsigned *lineno,
arg->r_opt = -arg->r_opt;
if( !opts[index].short_opt )
arg->r_opt = -2; /* unknown option */
else if( (opts[index].flags & 8) ) /* no optional argument */
arg->r_type = 0; /* okay */
else /* no required argument */
else if( (opts[index].flags & 8) ) /* no argument */
arg->r_opt = -3; /* error */
else /* no or optiona argument */
arg->r_type = 0; /* okay */
break;
}
else if( state == 3 ) { /* no argument found */

View file

@ -129,11 +129,19 @@ log_bug( const char *fmt, ... )
abort();
}
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5 )
void
log_bug0()
log_bug0( const char *file, int line, const char *func )
{
log_bug("Ohhhh jeeee ...\n");
log_bug("Ohhhh jeeee ... (%s:%d:%s)\n", file, line, func );
}
#else
void
log_bug0( const char *file, int line )
{
log_bug("Ohhhh jeeee ... (%s:%d)\n", file, line);
}
#endif
void
log_debug( const char *fmt, ... )

View file

@ -61,6 +61,8 @@ static unsigned cur_alloced;
static unsigned max_blocks;
static unsigned cur_blocks;
static int disable_secmem;
static int show_warning;
static int no_warning;
static void
lock_pool( void *p, size_t n )
@ -82,7 +84,7 @@ lock_pool( void *p, size_t n )
if( err ) {
if( errno != EPERM )
log_error("can´t lock memory: %s\n", strerror(err));
log_info(_("Warning: using insecure memory!\n"));
show_warning = 1;
}
#else
@ -132,6 +134,17 @@ compress_pool(void)
}
void
secmem_set_flags( unsigned flags )
{
no_warning = flags & 1;
}
unsigned
secmem_get_flags(void)
{
return no_warning ? 1:0;
}
void
secmem_init( size_t n )
@ -156,7 +169,12 @@ secmem_malloc( size_t size )
int compressed=0;
if( !pool_okay )
init_pool(DEFAULT_POOLSIZE);
log_bug("secmem not initialized\n");
if( show_warning ) {
show_warning = 0;
if( !no_warning )
log_info(_("Warning: using insecure memory!\n"));
}
/* blocks are always a multiple of 32 */
size += sizeof(MEMBLOCK);

View file

@ -50,6 +50,28 @@ add_to_strlist( STRLIST *list, const char *string )
*list = sl;
}
STRLIST
strlist_prev( STRLIST head, STRLIST node )
{
STRLIST n;
for(n=NULL; head && head != node; head = head->next )
n = head;
return n;
}
STRLIST
strlist_last( STRLIST node )
{
if( node )
for( ; node->next ; node = node->next )
;
return node;
}
/****************
* look for the substring SUB in buffer and return a pointer to that
* substring in BUF or NULL if not found.