From 78d93797d4c89a6e2c43211bef422af906d38c53 Mon Sep 17 00:00:00 2001 From: "Anna (navi) Figueiredo Gomes" Date: Wed, 25 Sep 2024 02:21:07 +0200 Subject: [PATCH] librc: Don't include stacked runlevels in ls_dir with LS_INITD. ls_dir is used to list services in a runlevel, in which directories are stacked runlevels, not init scripts. And in general, folders are not allowed in init.d dirs anyway. --- src/librc/librc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/librc/librc.c b/src/librc/librc.c index 25dd4a798..86a52674b 100644 --- a/src/librc/librc.c +++ b/src/librc/librc.c @@ -94,7 +94,8 @@ ls_dir(const char *dir, int options) xasprintf(&file, "%s/%s", dir, d->d_name); r = stat(file, &buf); free(file); - if (r != 0) + /* stacked runlevels are not init scripts */ + if (r != 0 || S_ISDIR(buf.st_mode)) continue; /* .sh files are not init scripts */