summaryrefslogtreecommitdiff
path: root/crypto/err
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2002-01-24 16:16:43 +0000
committerBodo Möller <bodo@openssl.org>2002-01-24 16:16:43 +0000
commita14e2d9dfe0bc17800a5ab6b0439a3db50702586 (patch)
tree8c2cd60a3175e666ca68800fc0d245e65af1d496 /crypto/err
parenta8b94d64095204817c7c561d069322d4df12010e (diff)
downloadopenssl-new-a14e2d9dfe0bc17800a5ab6b0439a3db50702586.tar.gz
New functions
ERR_peek_last_error ERR_peek_last_error_line ERR_peek_last_error_line_data (supersedes ERR_peek_top_error). Rename OPENSSL_NO_OLD_DES_SUPPORT into OPENSSL_DISABLE_OLD_DES_SUPPORT because OPENSSL_NO_... indicates disabled algorithms (according to mkdef.pl).
Diffstat (limited to 'crypto/err')
-rw-r--r--crypto/err/err.c47
-rw-r--r--crypto/err/err.h9
2 files changed, 37 insertions, 19 deletions
diff --git a/crypto/err/err.c b/crypto/err/err.c
index 1b1e9bbcb0..c909c3f4dc 100644
--- a/crypto/err/err.c
+++ b/crypto/err/err.c
@@ -318,7 +318,7 @@ static int err_cmp(const void *a_void, const void *b_void);
static unsigned long pid_hash(const void *pid_void);
/* static int pid_cmp(ERR_STATE *a,ERR_STATE *pid); */
static int pid_cmp(const void *a_void,const void *pid_void);
-static unsigned long get_error_values(int inc,const char **file,int *line,
+static unsigned long get_error_values(int inc,int top,const char **file,int *line,
const char **data,int *flags);
/* The internal functions used in the "err_defaults" implementation */
@@ -666,35 +666,37 @@ void ERR_clear_error(void)
unsigned long ERR_get_error(void)
- { return(get_error_values(1,NULL,NULL,NULL,NULL)); }
+ { return(get_error_values(1,0,NULL,NULL,NULL,NULL)); }
unsigned long ERR_get_error_line(const char **file,
int *line)
- { return(get_error_values(1,file,line,NULL,NULL)); }
+ { return(get_error_values(1,0,file,line,NULL,NULL)); }
unsigned long ERR_get_error_line_data(const char **file, int *line,
const char **data, int *flags)
- { return(get_error_values(1,file,line,data,flags)); }
+ { return(get_error_values(1,0,file,line,data,flags)); }
unsigned long ERR_peek_error(void)
- { return(get_error_values(0,NULL,NULL,NULL,NULL)); }
+ { return(get_error_values(0,0,NULL,NULL,NULL,NULL)); }
-unsigned long ERR_peek_top_error(void)
- {
- ERR_STATE *es=ERR_get_state();
+unsigned long ERR_peek_last_error(void)
+ { return(get_error_values(0,1,NULL,NULL,NULL,NULL)); }
- return es->err_buffer[es->top];
- }
+unsigned long ERR_peek_error_line(const char **file, int *line)
+ { return(get_error_values(0,0,file,line,NULL,NULL)); }
-unsigned long ERR_peek_error_line(const char **file,
- int *line)
- { return(get_error_values(0,file,line,NULL,NULL)); }
+unsigned long ERR_peek_last_error_line(const char **file, int *line)
+ { return(get_error_values(0,1,file,line,NULL,NULL)); }
unsigned long ERR_peek_error_line_data(const char **file, int *line,
const char **data, int *flags)
- { return(get_error_values(0,file,line,data,flags)); }
+ { return(get_error_values(0,0,file,line,data,flags)); }
+
+unsigned long ERR_peek_last_error_line_data(const char **file, int *line,
+ const char **data, int *flags)
+ { return(get_error_values(0,1,file,line,data,flags)); }
-static unsigned long get_error_values(int inc, const char **file, int *line,
+static unsigned long get_error_values(int inc, int top, const char **file, int *line,
const char **data, int *flags)
{
int i=0;
@@ -703,8 +705,21 @@ static unsigned long get_error_values(int inc, const char **file, int *line,
es=ERR_get_state();
+ if (inc && top)
+ {
+ if (file) *file = "";
+ if (line) *line = 0;
+ if (data) *data = "";
+ if (flags) *flags = 0;
+
+ return ERR_R_INTERNAL_ERROR;
+ }
+
if (es->bottom == es->top) return 0;
- i=(es->bottom+1)%ERR_NUM_ERRORS;
+ if (top)
+ i=(es->bottom+1)%ERR_NUM_ERRORS; /* last error */
+ else
+ i=(es->bottom+1)%ERR_NUM_ERRORS; /* first error */
ret=es->err_buffer[i];
if (inc)
diff --git a/crypto/err/err.h b/crypto/err/err.h
index 4456e0e971..adf52e21b7 100644
--- a/crypto/err/err.h
+++ b/crypto/err/err.h
@@ -238,15 +238,18 @@ typedef struct ERR_string_data_st
void ERR_put_error(int lib, int func,int reason,const char *file,int line);
void ERR_set_error_data(char *data,int flags);
-unsigned long ERR_get_error(void );
+unsigned long ERR_get_error(void);
unsigned long ERR_get_error_line(const char **file,int *line);
unsigned long ERR_get_error_line_data(const char **file,int *line,
const char **data, int *flags);
-unsigned long ERR_peek_error(void );
-unsigned long ERR_peek_top_error(void);
+unsigned long ERR_peek_last_error(void);
+unsigned long ERR_peek_error(void);
unsigned long ERR_peek_error_line(const char **file,int *line);
+unsigned long ERR_peek_last_error_line(const char **file,int *line);
unsigned long ERR_peek_error_line_data(const char **file,int *line,
const char **data,int *flags);
+unsigned long ERR_peek_last_error_line_data(const char **file,int *line,
+ const char **data,int *flags);
void ERR_clear_error(void );
char *ERR_error_string(unsigned long e,char *buf);
void ERR_error_string_n(unsigned long e, char *buf, size_t len);