From c113045a71f3da42e1406b1f99766eb9c946ffcd Mon Sep 17 00:00:00 2001 From: Patrick Gaskin Date: Wed, 22 Apr 2020 18:36:30 -0400 Subject: [PATCH] Fixed the failsafe when running from the Qt plugins dir For some reason, it tries to load all files in it, whether or not they end with .so. --- src/failsafe.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/failsafe.c b/src/failsafe.c index 7b98e76..1f8a481 100644 --- a/src/failsafe.c +++ b/src/failsafe.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include "failsafe.h" @@ -26,6 +27,8 @@ nmi_failsafe_t *nmi_failsafe_create(char **err_out) { Dl_info info; NMI_ASSERT(dladdr(nmi_failsafe_create, &info), "could not find own path"); NMI_ASSERT(info.dli_fname, "dladdr did not return a filename"); + char *d = strrchr(info.dli_fname, '.'); + NMI_ASSERT(!(d && !strcmp(d, ".failsafe")), "lib was loaded from the failsafe for some reason"); NMI_ASSERT((fs->orig = realpath(info.dli_fname, NULL)), "could not resolve %s", info.dli_fname); NMI_ASSERT(asprintf(&fs->tmp, "%s.failsafe", fs->orig) != -1, "could not generate temp filename");