diff options
author | Richard Braun <rbraun@sceen.net> | 2018-01-04 00:32:47 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2018-01-04 00:32:47 +0100 |
commit | c1ebfc97887a8efbd02b25379cc40d1086d0ad46 (patch) | |
tree | ee2d5ab7e529d90ee35940cb748b4ec270a19476 /error.c | |
parent | a0568115cdc9e6aa14820c5553f45f6ec701fb0c (diff) |
error: replace error_die with error_check
Diffstat (limited to 'error.c')
-rw-r--r-- | error.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -1,5 +1,5 @@ /* - * Copyright (c) 2009-2015 Richard Braun. + * Copyright (c) 2009-2018 Richard Braun. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -86,8 +86,15 @@ error_from_errno(int errno_code) } void -error_die(unsigned int error) +error_check(int error, const char *prefix) { - fprintf(stderr, "process terminating, reason: %s\n", error_str(error)); + if (!error) { + return; + } + + fprintf(stderr, "%s%s%s\n", + (prefix == NULL) ? "" : prefix, + (prefix == NULL) ? "" : ": ", + error_str(error)); abort(); } |