Skip to content

Commit 78d9379

Browse files
navi-desuwilliamh
authored andcommitted
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.
1 parent 57a39fd commit 78d9379

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/librc/librc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ ls_dir(const char *dir, int options)
9494
xasprintf(&file, "%s/%s", dir, d->d_name);
9595
r = stat(file, &buf);
9696
free(file);
97-
if (r != 0)
97+
/* stacked runlevels are not init scripts */
98+
if (r != 0 || S_ISDIR(buf.st_mode))
9899
continue;
99100

100101
/* .sh files are not init scripts */

0 commit comments

Comments
 (0)