Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | From 6878a83f9bac015c64d83cee42530a20a264cc5a Mon Sep 17 00:00:00 2001 |
| 2 | From: Alexander Kanavin <alex.kanavin@gmail.com> |
| 3 | Date: Tue, 7 Jan 2020 12:02:06 +0100 |
| 4 | Subject: [PATCH] rpmplugins.c: call dlerror() prior to dlsym() |
| 5 | |
| 6 | This is the recommended way in the manpage; if there is |
| 7 | a lingering error from an unrelated dl*() call that was |
| 8 | never obtained via dlerror(), it needs to be cleared |
| 9 | prior to calling dlsym(). |
| 10 | |
| 11 | Upstream-Status: Submitted [https://github.com/rpm-software-management/rpm/pull/998] |
| 12 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> |
| 13 | --- |
| 14 | lib/rpmplugins.c | 2 ++ |
| 15 | 1 file changed, 2 insertions(+) |
| 16 | |
| 17 | diff --git a/lib/rpmplugins.c b/lib/rpmplugins.c |
| 18 | index 65e684e84..b950f85cf 100644 |
| 19 | --- a/lib/rpmplugins.c |
| 20 | +++ b/lib/rpmplugins.c |
| 21 | @@ -68,6 +68,8 @@ static rpmPlugin rpmPluginNew(const char *name, const char *path, |
| 22 | |
| 23 | /* make sure the plugin has the supported hooks flag */ |
| 24 | hooks_name = rstrscat(NULL, name, "_hooks", NULL); |
| 25 | + /* clear out any old errors that weren't fetched */ |
| 26 | + dlerror(); |
| 27 | hooks = dlsym(handle, hooks_name); |
| 28 | if ((error = dlerror()) != NULL) { |
| 29 | rpmlog(RPMLOG_ERR, _("Failed to resolve symbol %s: %s\n"), |