diff options
Diffstat (limited to 'util')
-rw-r--r-- | util/ChangeLog | 4 | ||||
-rw-r--r-- | util/errors.c | 5 | ||||
-rw-r--r-- | util/iobuf.c | 10 | ||||
-rw-r--r-- | util/strgutil.c | 21 |
4 files changed, 38 insertions, 2 deletions
diff --git a/util/ChangeLog b/util/ChangeLog index 76e85131d..5baefcc20 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,7 @@ +Mon Jul 6 09:03:49 1998 Werner Koch ([email protected]) + + * strgutil.c (append_to_strlist): New. + Thu Jul 2 15:55:44 1998 Werner Koch ([email protected]) * iobuf.c (block_filter): Add writing of OP partial length headers. diff --git a/util/errors.c b/util/errors.c index b71ff4f49..6b72576b5 100644 --- a/util/errors.c +++ b/util/errors.c @@ -64,7 +64,7 @@ g10_errstr( int err ) X(CIPHER_ALGO ,"Unknown cipher algorithm") X(KEYRING_OPEN ,"Can't open the keyring") X(INVALID_PACKET ,"Invalid packet") - X(BAD_RING ,"Broken keyring") + X(INVALID_ARMOR ,"Invalid armor") X(NO_USER_ID ,"No such user id") X(NO_SECKEY ,"Secret key not available") X(WRONG_SECKEY ,"Wrong secret key used") @@ -80,6 +80,9 @@ g10_errstr( int err ) X(NI_CIPHER ,"Unimplemented cipher algorithm") X(SIG_CLASS ,"Unknown signature class") X(TRUSTDB ,"Trust database error") + X(BAD_MPI ,"Bad MPI") + X(RESOURCE_LIMIT ,"Resource limit") + X(INV_KEYRING ,"Invalid keyring") X(BAD_CERT ,"Bad certificate") X(INV_USER_ID ,"Malformed user id") X(CLOSE_FILE ,"File close error") diff --git a/util/iobuf.c b/util/iobuf.c index 7be3431bc..bd69322b9 100644 --- a/util/iobuf.c +++ b/util/iobuf.c @@ -739,6 +739,11 @@ underflow(IOBUF a) log_debug("iobuf-%d.%d: filter eof\n", a->no, a->subno ); return -1; } + if( a->error ) { + if( DBG_IOBUF ) + log_debug("iobuf-%d.%d: error\n", a->no, a->subno ); + return -1; + } if( a->filter ) { len = a->d.size; @@ -758,6 +763,8 @@ underflow(IOBUF a) } a->filter_eof = 1; } + else if( rc ) + a->error = 1; if( !len ) return -1; @@ -802,6 +809,8 @@ iobuf_flush(IOBUF a) log_info("iobuf_flush did not write all!\n"); rc = G10ERR_WRITE_FILE; } + else if( rc ) + a->error = 1; a->d.len = 0; return rc; @@ -1058,6 +1067,7 @@ iobuf_seek( IOBUF a, ulong newpos ) a->nbytes = 0; a->nlimit = 0; a->ntotal = newpos; + a->error = 0; /* remove filters, but the last */ while( a->chain ) iobuf_pop_filter( a, a->filter, NULL ); diff --git a/util/strgutil.c b/util/strgutil.c index c6c8f5a65..d19ba6e54 100644 --- a/util/strgutil.c +++ b/util/strgutil.c @@ -39,7 +39,7 @@ free_strlist( STRLIST sl ) } -void +STRLIST add_to_strlist( STRLIST *list, const char *string ) { STRLIST sl; @@ -48,6 +48,25 @@ add_to_strlist( STRLIST *list, const char *string ) strcpy(sl->d, string); sl->next = *list; *list = sl; + return sl; +} + +STRLIST +append_to_strlist( STRLIST *list, const char *string ) +{ + STRLIST r, sl; + + sl = m_alloc( sizeof *sl + strlen(string)); + strcpy(sl->d, string); + sl->next = NULL; + if( !*list ) + *list = sl; + else { + for( r = *list; r->next; r = r->next ) + ; + r->next = sl; + } + return sl; } |