mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-21 19:26:22 +02:00
libreboot-utils: unified error handling
i now use a singleton hook function per program: nvmutil, mkhtemp and lottery call this at the startup of your program: (void) errhook(exit_cleanup); then provide that function. make it static, so that each program has its own version. if you're writing a program that handles lots of files for example, and you want to do certain cleanup on exit (including error exit), this can be quite useful. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -51,6 +51,6 @@ void
|
||||
check_bin(size_t a, const char *a_name)
|
||||
{
|
||||
if (a > 1)
|
||||
err_no_cleanup(0, EINVAL, "%s must be 0 or 1, but is %lu",
|
||||
err_exit(EINVAL, "%s must be 0 or 1, but is %lu",
|
||||
a_name, (size_t)a);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user