From 67a4ba4228d878fe7f5484ab8d80178ca51ce6e6 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 13 Dec 2020 10:56:36 +0100 Subject: [PATCH] Fixed error handling when loading a plugin --- CONTRIBUTORS | 1 + HISTORY | 3 ++- plugin.c | 9 ++++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 1c1602f8..3606271d 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2523,6 +2523,7 @@ Nino Gerbino Markus Ehrnsperger for reporting a problem with missing 'INCLUDES += -I$(DVBDIR)/include' in an existing Make.config + for reporting a bug in error handling when loading a plugin Werner Färber for reporting a bug in handling the cPluginManager::Active() result when pressing diff --git a/HISTORY b/HISTORY index b0467e9e..1d26d21d 100644 --- a/HISTORY +++ b/HISTORY @@ -9536,7 +9536,7 @@ Video Disk Recorder Revision History cDvbTuner::GetSignalStats() to avoid problems with drivers that don't do this (thanks to Helmut Binder). -2020-12-12: +2020-12-13: - Fixed multiple recording entries in case a recording is started during the initial reading of the video directory (reported by Claus Muus). @@ -9555,3 +9555,4 @@ Video Disk Recorder Revision History Binder). - Avoiding a lengthy lock on the Channels list when starting a recording (thanks to Helmut Binder). +- Fixed error handling when loading a plugin (reported by Markus Ehrnsperger). diff --git a/plugin.c b/plugin.c index 0e0f2d13..cad2cd56 100644 --- a/plugin.c +++ b/plugin.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: plugin.c 4.2 2020/06/29 09:29:06 kls Exp $ + * $Id: plugin.c 4.3 2020/12/13 10:56:36 kls Exp $ */ #include "plugin.h" @@ -229,9 +229,12 @@ bool cDll::Load(bool Log) if (!error) { typedef cPlugin *create_t(void); create_t *create = (create_t *)dlsym(handle, "VDRPluginCreator"); - if (!(error = dlerror())) + error = dlerror(); + if (!error && create) { plugin = create(); - destroy = (destroy_t *)dlsym(handle, "VDRPluginDestroyer"); + destroy = (destroy_t *)dlsym(handle, "VDRPluginDestroyer"); + error = dlerror(); + } } if (!error) { if (plugin && args) {