diff options
| author | Guillem Jover <guillem@debian.org> | 2019-01-27 05:06:38 +0100 |
|---|---|---|
| committer | Guillem Jover <guillem@debian.org> | 2019-02-23 17:57:18 +0100 |
| commit | 2385d08c1f67e48de86fc0daa504fef572c99e28 (patch) | |
| tree | 001151e6c8cb196f00295c26696b6aadebba485f /lib | |
| parent | 81f3c2f460915cfb5f85c4d536b822cf402bb44d (diff) | |
| download | dpkg-2385d08c1f67e48de86fc0daa504fef572c99e28.tar.gz | |
libdpkg: Add new dpkg_has_error() function
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/dpkg/error.c | 6 | ||||
| -rw-r--r-- | lib/dpkg/error.h | 4 | ||||
| -rw-r--r-- | lib/dpkg/libdpkg.map | 1 |
3 files changed, 11 insertions, 0 deletions
diff --git a/lib/dpkg/error.c b/lib/dpkg/error.c index 0e88d399a..025c558ac 100644 --- a/lib/dpkg/error.c +++ b/lib/dpkg/error.c @@ -45,6 +45,12 @@ dpkg_error_set(struct dpkg_error *err, enum dpkg_msg_type type, int syserrno, err->str = str.buf; } +bool +dpkg_has_error(struct dpkg_error *err) +{ + return err != NULL && err->type != DPKG_MSG_NONE; +} + int dpkg_put_warn(struct dpkg_error *err, const char *fmt, ...) { diff --git a/lib/dpkg/error.h b/lib/dpkg/error.h index 31f8e4e8f..9fd7ead21 100644 --- a/lib/dpkg/error.h +++ b/lib/dpkg/error.h @@ -21,6 +21,8 @@ #ifndef LIBDPKG_ERROR_H #define LIBDPKG_ERROR_H +#include <stdbool.h> + #include <dpkg/macros.h> DPKG_BEGIN_DECLS @@ -48,6 +50,8 @@ struct dpkg_error { #define DPKG_ERROR_OBJECT (struct dpkg_error)DPKG_ERROR_INIT +bool dpkg_has_error(struct dpkg_error *err); + int dpkg_put_warn(struct dpkg_error *err, const char *fmt, ...) DPKG_ATTR_PRINTF(2); int dpkg_put_error(struct dpkg_error *err, const char *fmt, ...) diff --git a/lib/dpkg/libdpkg.map b/lib/dpkg/libdpkg.map index 13728403f..e30052b0d 100644 --- a/lib/dpkg/libdpkg.map +++ b/lib/dpkg/libdpkg.map @@ -1,6 +1,7 @@ LIBDPKG_0 { global: # Error reporting + dpkg_has_error; dpkg_put_warn; dpkg_put_error; dpkg_put_errno; |
