1
0
mirror of https://github.com/containers/podman.git synced 2026-02-05 06:45:31 +01:00

fix(emulation): handle fs.ErrNotExist in registeredBinfmtMisc

When `/proc/sys/fs/binfmt_misc` is not mounted, filepath.WalkDir may return
fs.ErrNotExist errors. These should be handled gracefully and return nil
instead of causing a panic.

Signed-off-by: Peiyuan Song <squallatf@gmail.com>
This commit is contained in:
Peiyuan Song
2025-09-08 17:18:32 +08:00
parent b6d92f7df5
commit 04af9ae3fc

View File

@@ -27,7 +27,10 @@ func registeredBinfmtMisc() ([]string, error) {
if filepath.Base(path) == "register" { // skip this one
return nil
}
if err != nil && !errors.Is(err, os.ErrNotExist) {
if err != nil {
if errors.Is(err, fs.ErrNotExist) {
return nil
}
return err
}
info, err := d.Info()