Skip to content

Commit

Permalink
leveldb: fix systemdActive()
Browse files Browse the repository at this point in the history
/sys/fs/cgroup/systemd is long gone:

https://systemd.io/CGROUP_DELEGATION/

Check for /run/systemd/system/ directory existence instead:

https://www.freedesktop.org/software/systemd/man/sd_booted.html

Closes #116
  • Loading branch information
marcosfrm committed Oct 15, 2023
1 parent c3511a1 commit e9c2789
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions leveldb.c
Original file line number Diff line number Diff line change
Expand Up @@ -946,13 +946,7 @@ int systemdIsInit() {
}

int systemdActive() {
struct stat a, b;

if (lstat("/sys/fs/cgroup", &a) < 0)
return 0;
if (lstat("/sys/fs/cgroup/systemd", &b) < 0)
return 0;
if (a.st_dev == b.st_dev)
if (access("/run/systemd/system/", F_OK) < 0)
return 0;
if (!systemdIsInit())
return 0;
Expand Down

0 comments on commit e9c2789

Please sign in to comment.