diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-06-12 02:32:54 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2025-06-12 02:32:54 -0600 |
commit | 0474953ab2600ee3b6bc17ba605b8e7877e181fe (patch) | |
tree | 5d3d4499d81d6a9f5422caf0694051272a1f6335 /libmisc/error.c | |
parent | 8ce568bae1cc9a77996f16b859482992d27e0b37 (diff) | |
parent | 43cacf95462588de0ab3125bdea7a37f10ebf8fc (diff) |
Merge branch 'lukeshu/better-net-flash'
Diffstat (limited to 'libmisc/error.c')
-rw-r--r-- | libmisc/error.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libmisc/error.c b/libmisc/error.c index dfe4e80..345755c 100644 --- a/libmisc/error.c +++ b/libmisc/error.c @@ -4,6 +4,8 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ +#include <string.h> /* for strdup() */ + #include <libmisc/error.h> const char *error_msg(error err) { @@ -12,6 +14,13 @@ const char *error_msg(error err) { : _errnum_str_msg(err.num); } +error error_dup(error err) { + return (error){ + .num = err.num, + ._msg = err._msg ? strdup(err._msg) : NULL, + }; +} + void error_cleanup(error *errptr) { if (!errptr) return; |