Skip to content

Commit

Permalink
librc: Don't include stacked runlevels in ls_dir with LS_INITD.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
navi-desu authored and williamh committed Sep 25, 2024
1 parent 57a39fd commit 78d9379
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/librc/librc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 78d9379

Please sign in to comment.