[openssl] master update

Richard Levitte levitte at openssl.org
Mon Sep 30 08:29:08 UTC 2019


The branch master has been updated
       via  df0822688fc3432cf800cdc07c7f9016ea201170 (commit)
      from  94bd168a9e31d1ab4986e94056dfae71ec5f051f (commit)


- Log -----------------------------------------------------------------
commit df0822688fc3432cf800cdc07c7f9016ea201170
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date:   Thu Sep 19 15:02:50 2019 +0200

    Make default values by ERR_get_error_all() and friends more consistent
    
    Unset data defaults to the empty string ("") or 0.
    
    Reviewed-by: Tomas Mraz <tmraz at fedoraproject.org>
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9948)

-----------------------------------------------------------------------

Summary of changes:
 crypto/err/err.c           | 27 +++++++++++----------------
 doc/man3/ERR_get_error.pod | 29 ++++++++++++++++++-----------
 2 files changed, 29 insertions(+), 27 deletions(-)

diff --git a/crypto/err/err.c b/crypto/err/err.c
index eca0f6d33e..f46f3bef30 100644
--- a/crypto/err/err.c
+++ b/crypto/err/err.c
@@ -533,35 +533,30 @@ static unsigned long get_error_values(ERR_GET_ACTION g,
         es->err_buffer[i] = 0;
     }
 
-    if (file != NULL && line != NULL) {
-        if (es->err_file[i] == NULL) {
-            *file = "NA";
-            *line = 0;
-        } else {
-            *file = es->err_file[i];
-            *line = es->err_line[i];
-        }
+    if (file != NULL) {
+        *file = es->err_file[i];
+        if (*file == NULL)
+            *file = "";
     }
-
+    if (line != NULL)
+        *line = es->err_line[i];
     if (func != NULL) {
         *func = es->err_func[i];
         if (*func == NULL)
-            *func = "N/A";
+            *func = "";
     }
-
+    if (flags != NULL)
+        *flags = es->err_data_flags[i];
     if (data == NULL) {
         if (g == EV_POP) {
             err_clear_data(es, i, 0);
         }
     } else {
-        if (es->err_data[i] == NULL) {
+        *data = es->err_data[i];
+        if (*data == NULL) {
             *data = "";
             if (flags != NULL)
                 *flags = 0;
-        } else {
-            *data = es->err_data[i];
-            if (flags != NULL)
-                *flags = es->err_data_flags[i];
         }
     }
     return ret;
diff --git a/doc/man3/ERR_get_error.pod b/doc/man3/ERR_get_error.pod
index 045ef210a2..136b70db46 100644
--- a/doc/man3/ERR_get_error.pod
+++ b/doc/man3/ERR_get_error.pod
@@ -61,28 +61,35 @@ error queue without modifying it.
 ERR_peek_last_error() returns the latest error code from the thread's
 error queue without modifying it.
 
-See L<ERR_GET_LIB(3)> for obtaining information about
-location and reason of the error, and
-L<ERR_error_string(3)> for human-readable error
-messages.
+See L<ERR_GET_LIB(3)> for obtaining further specific information
+such as the reason of the error,
+and L<ERR_error_string(3)> for human-readable error messages.
 
 ERR_get_error_line(), ERR_peek_error_line() and
 ERR_peek_last_error_line() are the same as ERR_get_error(),
-ERR_peek_error() and ERR_peek_last_error(), but they
+ERR_peek_error() and ERR_peek_last_error(), but on success they
 additionally store the file name and line number where
-the error occurred in *B<file> and *B<line>, unless these are B<NULL>.
+the error occurred in *B<file> and *B<line>, as far as they are not B<NULL>.
+An unset file name is indicated as B<"">, i.e., an empty string.
+An unset line number is indicated as B<0>.
+
+A pointer returned this way by these functions and the ones below
+is valid until the respective entry is removed from the error queue.
 
 ERR_get_error_func(), ERR_peek_error_func() and
 ERR_peek_last_error_func() are the same as ERR_get_error(),
-ERR_peek_error() and ERR_peek_last_error(), but they
-additionally store the name of the function where the error in *B<func>,
-unless it is B<NULL>.
+ERR_peek_error() and ERR_peek_last_error(), but on success they
+additionally store the name of the function where the error occurred
+in *B<func>, unless it is B<NULL>.
+An unset function name is indicated as B<"">.
 
 ERR_get_error_data(), ERR_peek_error_data() and
 ERR_peek_last_error_data() are the same as ERR_get_error(),
-ERR_peek_error() and ERR_peek_last_error(), but they
+ERR_peek_error() and ERR_peek_last_error(), but on success they
 additionally store additional data and flags associated with the error
-code in *B<data> and *B<flags>, unless these are B<NULL>.
+code in *B<data> and *B<flags>, as far as they are not B<NULL>.
+Unset data is indicated as B<"">.
+In this case the value given for the flag is irrelevant (and equals B<0>).
 *B<data> contains a string if *B<flags>&B<ERR_TXT_STRING> is true.
 
 ERR_get_error_all(), ERR_peek_error_all() and


More information about the openssl-commits mailing list