From 83ecb61890f12e182fbc877fe204b0199028a15b Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Wed, 5 Dec 2018 16:37:09 +0100 Subject: [PATCH] plugin: Ignore directories in the plugin-directory They pass the executable test, but aren't really executable. Signed-off-by: Christian Decker --- lightningd/plugin.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lightningd/plugin.c b/lightningd/plugin.c index 2336055e4..31c395650 100644 --- a/lightningd/plugin.c +++ b/lightningd/plugin.c @@ -664,7 +664,11 @@ static const char *plugin_fullpath(const tal_t *ctx, const char *dir, fullname = path_join(ctx, dir, basename); if (stat(fullname, &st) != 0) return tal_free(fullname); - if (!(st.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH))) + if (!(st.st_mode & (S_IXUSR|S_IXGRP|S_IXOTH)) || st.st_mode & S_IFDIR) + return tal_free(fullname); + + /* Ignore directories, they have exec mode, but aren't executable. */ + if (st.st_mode & S_IFDIR) return tal_free(fullname); return fullname; }