Skip to content

Commit

Permalink
Merge pull request #3559 from kolyshkin/fix-dev-pts
Browse files Browse the repository at this point in the history
Fix failed exec after systemctl daemon-reload
  • Loading branch information
kolyshkin authored Aug 18, 2022
2 parents 533250a + 7a72e99 commit 6b0f911
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions devices/systemd.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,16 @@ func systemdProperties(r *configs.Resources) ([]systemdDbus.Property, error) {
case devices.CharDevice:
entry.Path = fmt.Sprintf("/dev/char/%d:%d", rule.Major, rule.Minor)
}
// systemd will issue a warning if the path we give here doesn't exist.
// Since all of this logic is best-effort anyway (we manually set these
// rules separately to systemd) we can safely skip entries that don't
// have a corresponding path.
if _, err := os.Stat(entry.Path); err != nil {
logrus.Debugf("skipping device %s for systemd: %s", entry.Path, err)
continue
}
}
// systemd will issue a warning if the path we give here doesn't exist.
// Since all of this logic is best-effort anyway (we manually set these
// rules separately to systemd) we can safely skip entries that don't
// have a corresponding path.
if _, err := os.Stat(entry.Path); err == nil {
deviceAllowList = append(deviceAllowList, entry)
}
deviceAllowList = append(deviceAllowList, entry)
}

properties = append(properties, newProp("DeviceAllow", deviceAllowList))
Expand Down

0 comments on commit 6b0f911

Please sign in to comment.