ERR_get_error.3ssl man page

ERR_get_error, ERR_peek_error, ERR_peek_last_error, ERR_get_error_line, ERR_peek_error_line, ERR_peek_last_error_line, ERR_get_error_line_data, ERR_peek_error_line_data, ERR_peek_last_error_line_data — obtain error code and data

Synopsis

 #include <openssl/err.h>

 unsigned long ERR_get_error(void);
 unsigned long ERR_peek_error(void);
 unsigned long ERR_peek_last_error(void);

 unsigned long ERR_get_error_line(const char **file, int *line);
 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_get_error_line_data(const char **file, int *line,
         const char **data, int *flags);
 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);

Description

ERR_get_error() returns the earliest error code from the thread's error queue and removes the entry. This function can be called repeatedly until there are no more error codes to return.

ERR_peek_error() returns the earliest error code from the thread's error queue without modifying it.

ERR_peek_last_error() returns the latest error code from the thread's error queue without modifying it.

See ERR_GET_LIB(3) for obtaining information about location and reason of the error, and 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 the above, but they additionally store the file name and line number where the error occurred in *file and *line, unless these are NULL.

ERR_get_error_line_data(), ERR_peek_error_line_data() and ERR_peek_last_error_line_data() store additional data and flags associated with the error code in *data and *flags, unless these are NULL. *data contains a string if *flags&ERR_TXT_STRING is true.

An application MUST NOT free the *data pointer (or any other pointers returned by these functions) with OPENSSL_free() as freeing is handled automatically by the error library.

Return Values

The error code, or 0 if there is no error in the queue.

See Also

err(3), ERR_error_string(3), ERR_GET_LIB(3)

History

ERR_get_error(), ERR_peek_error(), ERR_get_error_line() and ERR_peek_error_line() are available in all versions of SSLeay and OpenSSL. ERR_get_error_line_data() and ERR_peek_error_line_data() were added in SSLeay 0.9.0. ERR_peek_last_error(), ERR_peek_last_error_line() and ERR_peek_last_error_line_data() were added in OpenSSL 0.9.7.

Referenced By

ASN1_generate_nconf.3ssl(3), ASN1_INTEGER_get_int64.3ssl(3), ASN1_OBJECT_new.3ssl(3), ASN1_STRING_length.3ssl(3), ASN1_STRING_new.3ssl(3), BIO_new_CMS.3ssl(3), BN_add.3ssl(3), BN_add_word.3ssl(3), BN_bn2bin.3ssl(3), BN_copy.3ssl(3), BN_CTX_new.3ssl(3), BN_CTX_start.3ssl(3), BN_generate_prime.3ssl(3), BN_mod_inverse.3ssl(3), BN_mod_mul_montgomery.3ssl(3), BN_mod_mul_reciprocal.3ssl(3), BN_new.3ssl(3), BN_rand.3ssl(3), BN_set_bit.3ssl(3), CMS_add0_cert.3ssl(3), CMS_add1_recipient_cert.3ssl(3), CMS_add1_signer.3ssl(3), CMS_compress.3ssl(3), CMS_decrypt.3ssl(3), CMS_encrypt.3ssl(3), CMS_final.3ssl(3), CMS_get0_RecipientInfos.3ssl(3), CMS_get0_SignerInfos.3ssl(3), CMS_get0_type.3ssl(3), CMS_get1_ReceiptRequest.3ssl(3), CMS_sign.3ssl(3), CMS_sign_receipt.3ssl(3), CMS_uncompress.3ssl(3), CMS_verify.3ssl(3), CMS_verify_receipt.3ssl(3), CRYPTO_set_ex_data.3ssl(3), d2i_ECPrivateKey.3ssl(3), d2i_PrivateKey.3ssl(3), d2i_X509.3ssl(3), DH_generate_key.3ssl(3), DH_generate_parameters.3ssl(3), DH_new.3ssl(3), DH_set_method.3ssl(3), DSA_do_sign.3ssl(3), DSA_dup_DH.3ssl(3), DSA_generate_key.3ssl(3), DSA_generate_parameters.3ssl(3), DSA_new.3ssl(3), DSA_set_method.3ssl(3), DSA_sign.3ssl(3), DSA_SIG_new.3ssl(3), ecdsa.3ssl(3), err.3ssl(3), ERR_clear_error.3ssl(3), ERR_error_string.3ssl(3), ERR_GET_LIB.3ssl(3), ERR_print_errors.3ssl(3), EVP_DigestSignInit.3ssl(3), EVP_DigestVerifyInit.3ssl(3), EVP_SignInit.3ssl(3), EVP_VerifyInit.3ssl(3), i2d_CMS_bio_stream.3ssl(3), i2d_PKCS7_bio_stream.3ssl(3), i2d_re_X509_tbs.3ssl(3), OBJ_nid2obj.3ssl(3), PEM_write_bio_CMS_stream.3ssl(3), PEM_write_bio_PKCS7_stream.3ssl(3), PKCS12_newpass.3ssl(3), PKCS12_parse.3ssl(3), PKCS7_decrypt.3ssl(3), PKCS7_encrypt.3ssl(3), PKCS7_sign.3ssl(3), PKCS7_sign_add_signer.3ssl(3), PKCS7_verify.3ssl(3), RAND_bytes.3ssl(3), RSA_check_key.3ssl(3), RSA_generate_key.3ssl(3), RSA_get_ex_new_index.3ssl(3), RSA_new.3ssl(3), RSA_padding_add_PKCS1_type_1.3ssl(3), RSA_private_encrypt.3ssl(3), RSA_public_encrypt.3ssl(3), RSA_set_method.3ssl(3), RSA_sign.3ssl(3), RSA_sign_ASN1_OCTET_STRING.3ssl(3), SMIME_read_CMS.3ssl(3), SMIME_read_PKCS7.3ssl(3), SMIME_write_CMS.3ssl(3), SMIME_write_PKCS7.3ssl(3), X509_CRL_get0_by_serial.3ssl(3), X509_get0_signature.3ssl(3), X509_get0_uids.3ssl(3), X509_get_notBefore.3ssl(3), X509_get_pubkey.3ssl(3), X509_get_serialNumber.3ssl(3), X509_get_subject_name.3ssl(3), X509_get_version.3ssl(3), X509_NAME_add_entry_by_txt.3ssl(3), X509_NAME_ENTRY_get_object.3ssl(3), X509_NAME_get_index_by_NID.3ssl(3), X509_new.3ssl(3), X509_PUBKEY_new.3ssl(3), X509_sign.3ssl(3), X509V3_get_d2i.3ssl(3).

2016-09-26 1.0.2j OpenSSL