ERR_SET_MARK(3SSL)

๐Ÿ’– ERR_SET_MARK(3SSL) โ€” the OpenSSL err.h mark & pop gang ๐Ÿ’–

okay bestie, welcome to the <openssl/err.h> manual, part of the OpenSSL 3SSL fam. this is the page about setting lil bookmarks in your error stack and popping stuff off the top. it's giving "annotate your chaos before you yeet it" energy and honestly? iconic. ๐ŸŽ€


โœจ NAME โœจ

ERR_set_mark, ERR_clear_last_mark, ERR_pop_to_mark, ERR_count_to_mark, ERR_pop โ€” set a mark, clear a mark, pop errors until you hit a mark, and pop the last error. the whole mark-and-pop friendgroup, together at last ๐Ÿซถ


๐ŸŒธ SYNOPSIS ๐ŸŒธ

#include <openssl/err.h>

int ERR_set_mark(void);
int ERR_pop_to_mark(void);
int ERR_clear_last_mark(void);
int ERR_count_to_mark(void);
int ERR_pop(void);

see how we love a consistent int-returning, no-argument queen? no args, no problems. ๐Ÿ’…


๐Ÿ’ซ DESCRIPTION ๐Ÿ’ซ

okay so here's the tea, one function at a time:

ERR_set_mark() drops a mark on the current topmost error record โ€” if there actually is one. no error record? no mark. simple as. ๐ŸŒˆ

ERR_pop_to_mark() just keeps popping the top of the error stack until it finds a mark. once it finds it, the mark is removed too. and if there is NO mark at all? bestie. the whole stack gets removed. all of it. gone. ๐Ÿ’€

ERR_clear_last_mark() removes the last mark that was added, if there is one. bye mark ๐Ÿ‘‹

ERR_count_to_mark() tells you how many entries are sitting on the error stack above the most recently marked entry โ€” and no, that marked entry is not included in the count, it's not about to be counted, it has main character boundaries. if there's no mark in the error stack at all, you just get the total number of entries in the error stack. ๐Ÿงฎ

ERR_pop() unconditionally pops a single error entry off the top of the error stack. "unconditionally" is doing a lot of work here โ€” this is the entry you'd get via ERR_peek_last_error(3), and it's getting popped whether you're emotionally ready or not. ๐Ÿ”ฅ


๐Ÿ’œ RETURN VALUES ๐Ÿ’œ

  • ERR_set_mark() โ€” returns 0 if the error stack is empty, otherwise 1.
  • ERR_clear_last_mark() and ERR_pop_to_mark() โ€” return 0 if there was no mark in the error stack, which implies the stack became empty. otherwise 1.
  • ERR_count_to_mark() โ€” returns the number of error stack entries found above the most recent mark, if there is one, or the total number of error stack entries.
  • ERR_pop() โ€” returns 1 if an error was popped, or 0 if the error stack was empty.

like, 0 keeps showing up as the "nope, nothing there" signal and honestly that's just its personality at this point. ๐Ÿ˜ญ


๐Ÿ“œ HISTORY ๐Ÿ“œ

  • ERR_count_to_mark() was added in OpenSSL 3.2.
  • ERR_pop() was added in OpenSSL 3.3.

fresh-ish additions, we love to see the glow-up timeline. โœจ


Copyright 2003-2024 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.

okay serious hat on for one sec: that license line is not a vibe, it's a requirement. don't skip it, don't "fix" it, don't paraphrase it. ๐Ÿซก

aaaand that's the whole page bestie, we ate and left no crumbs ๐Ÿ’…โœจ this was ERR_SET_MARK(3SSL) from OpenSSL 4.0.3, dated 2026-09-29. go set some marks on your error stack, you've got this ๐Ÿฆ‹๐Ÿ’–๐ŸŽ€

๐Ÿ“ฆ where this page comes from