Skip to content

Commit

Permalink
cmd/snapd-generator: read mountinfo for pid 1
Browse files Browse the repository at this point in the history
Systemd now runs generators in a sandbox. That means
`/proc/self/mountinfo` does not represent correctly the mounts of the
system.
  • Loading branch information
valentindavid authored and pedronis committed Oct 26, 2023
1 parent 3ab0acd commit 89eb305
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/snapd-generator/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ static sc_mountinfo_entry *find_root_mountinfo(sc_mountinfo * mounts)

static int ensure_root_fs_shared(const char *normal_dir)
{
// Load /proc/self/mountinfo so that we can inspect the root filesystem.
// Load /proc/1/mountinfo so that we can inspect the root filesystem.
sc_mountinfo *mounts SC_CLEANUP(sc_cleanup_mountinfo) = NULL;
mounts = sc_parse_mountinfo(NULL);
mounts = sc_parse_mountinfo("/proc/1/mountinfo");
if (!mounts) {
fprintf(stderr, "cannot open or parse /proc/self/mountinfo\n");
fprintf(stderr, "cannot open or parse /proc/1/mountinfo\n");
return 1;
}

Expand Down

0 comments on commit 89eb305

Please sign in to comment.