ERR_GET_LIB(3)

πŸ“¦ version 4.1.0, in opensuse-leap 16.0

✨ ERR_GET_LIB ✨

okay so bestie, this is the manual page for ERR_GET_LIB(3), and it's literally the group chat for OpenSSL error codes πŸ’… let me break it down for you.


🌸 NAME 🌸

ERR_GET_LIB, ERR_GET_FUNC, ERR_GET_REASON, ERR_FATAL_ERROR β€” get library, function, and reason codes for OpenSSL errors πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <openssl/err.h>

int
ERR_GET_LIB(unsigned long e);

int
ERR_GET_FUNC(unsigned long e);

int
ERR_GET_REASON(unsigned long e);

int
ERR_FATAL_ERROR(unsigned long e);

πŸ’– DESCRIPTION πŸ’–

okay so picture this: the error code that ERR_get_error(3) hands you is literally a little bundle of info β€” it's got a library number, a function code, and a reason code all packed inside. and ERR_GET_LIB(), ERR_GET_FUNC(), and ERR_GET_REASON() are the besties that unpack it for you 🫢

the library number and function code are the "where did this happen" energy β€” they tell you where the error occurred. the reason code is the "what even went wrong" tea β˜• β€” it's the actual info about what broke.

each sub-library of OpenSSL has its own unique library number, no cap. and function and reason codes are unique within each sub-library. so like... different libraries can absolutely use the same value to signal different functions and reasons πŸ‘€ not confusing at all, i know.

the ERR_R_* reason codes β€” think ERR_R_MALLOC_FAILURE β€” are globally unique, slay. but bestie listen: when you're checking for sub-library specific reason codes, make sure you also compare the library number. don't skip that step, it's giving cautionary tale πŸ’€

and ERR_FATAL_ERROR() tells you whether a given error code is a fatal error. iconic.

oh and also? these functions are implemented as macros. just so you know ✨


πŸ”₯ RETURN VALUES πŸ”₯

  • ERR_GET_LIB() returns the library number πŸ’œ
  • ERR_GET_FUNC() returns the function code πŸŽ€
  • ERR_GET_REASON() returns the reason code 🌸
  • ERR_FATAL_ERROR() returns non-zero if the error is fatal, or 0 otherwise ⭐

🌈 SEE ALSO 🌈


πŸ‘‘ HISTORY πŸ‘‘

ERR_GET_LIB(), ERR_GET_FUNC(), ERR_GET_REASON(), and ERR_FATAL_ERROR() first appeared in SSLeay 0.4.4 and have been available since OpenBSD 2.4. so they're basically vintage royalty at this point, periodt πŸ‘‘


this page came from Debian and it's dated March 27, 2018 β€” a lil throwback, but the info still eats πŸ’…βœ¨
πŸ“¦ where this page comes from