Hi, On error, the BN functions do not set errno, so errx(3) should be used instead of err(3). Moreover, one may call ERR_reason_error_string(3) to obtain a real error message from an error code.
$ dc -e '2 2 64^^' dc: big number failure 3fff072: Undefined error: 0 $ ./dc -e '2 2 64^^' dc: BN failure: bignum too long Index: mem.c =================================================================== RCS file: /cvs/src/usr.bin/dc/mem.c,v retrieving revision 1.9 diff -u -p -r1.9 mem.c --- mem.c 12 Dec 2017 19:08:57 -0000 1.9 +++ mem.c 15 Dec 2017 09:35:48 -0000 @@ -91,13 +91,19 @@ bstrdup(const char *p) void bn_check(int x) { - if (x == 0) - err(1, "big number failure %lx", ERR_get_error()); + if (x == 0) { + ERR_load_BN_strings(); + errx(1, "BN failure: %s", + ERR_reason_error_string(ERR_get_error())); + } } void bn_checkp(const void *p) { - if (p == NULL) - err(1, "allocation failure %lx", ERR_get_error()); + if (p == NULL) { + ERR_load_BN_strings(); + errx(1, "BN failure: %s", + ERR_reason_error_string(ERR_get_error())); + } } Regards, kshe