diff options
author | Joel Kitching <kitching@google.com> | 2019-06-28 14:53:57 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-07-22 09:13:52 +0000 |
commit | 772908aef95bf21d139a06c45c674241da9af6ac (patch) | |
tree | d32ab63b53062636af662950f960071d1dcb0415 /futility/futility.h | |
parent | a529598bd4efc3355952e609fed17b504a738ea7 (diff) | |
download | vboot-772908aef95bf21d139a06c45c674241da9af6ac.tar.gz |
vboot/futility: update fatal errors to use FATAL
Previously, a mix of:
- DIE
- Fatal (customly defined in cmd_vbutil_kernel.c)
- VbExError
... were all used to print an error message and exit.
In the case of futility, standardize on using the FATAL macro
defined in futility.h.
BUG=b:124141368
TEST=Check that FATAL works correctly:
$ build/futility/futility vbutil_key --in a --out a --algorithm 18
FATAL: do_vbutil_key: Unknown option
TEST=make clean && make runtests
BRANCH=none
Change-Id: I97ca1153dc36e7208c69185883518c52d5d75293
Signed-off-by: Joel Kitching <kitching@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1679799
Commit-Queue: Joel Kitching <kitching@chromium.org>
Tested-by: Joel Kitching <kitching@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'futility/futility.h')
-rw-r--r-- | futility/futility.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/futility/futility.h b/futility/futility.h index 1de17f7f..f82986f1 100644 --- a/futility/futility.h +++ b/futility/futility.h @@ -82,16 +82,14 @@ extern const struct futil_cmd_t *const futil_cmds[]; #define BUILD_ASSERT(cond) _BA0_(cond, __LINE__) #endif -/* Fatal internal stupidness */ -#ifndef DIE -#define DIE do { \ - fprintf(stderr, MYNAME ": internal error at %s:%d\n", \ - __FILE__, __LINE__); \ - exit(1); \ +/* Fatal error (print error message and exit). */ +#define FATAL(format, ...) do { \ + fprintf(stderr, "FATAL: %s: " format, __func__, \ + ##__VA_ARGS__ ); \ + exit(1); \ } while (0) -#endif -/* Print error messages (similar to VbExError but won't exit). */ +/* Print error messages (won't exit). */ #define ERROR(format, ...) fprintf(stderr, "ERROR: %s: " format, __func__, \ ##__VA_ARGS__ ) #define WARN(format, ...) fprintf(stderr, "WARNING: %s: " format, __func__, \ |