mirror of
https://github.com/containers/podman.git
synced 2025-07-03 17:27:18 +08:00
Ignore result of EvalSymlinks on ENOENT
When the path does not exist, filepath.EvalSymlinks returns an empty string - so we can't just ignore ENOENT, we have to discard the result if an ENOENT is returned. Should fix Jira issue RHEL-37948 Signed-off-by: Matt Heon <mheon@redhat.com>
This commit is contained in:
@ -3,9 +3,7 @@
|
||||
package libpod
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
@ -237,20 +235,18 @@ func readOnlyValidateConfig(bucket *bolt.Bucket, toCheck dbConfigValidation) (bo
|
||||
// which is symlinked to /var/home.
|
||||
if toCheck.isPath {
|
||||
if dbValue != "" {
|
||||
// Ignore ENOENT on both, on a fresh system some paths
|
||||
// may not exist this early in Libpod init.
|
||||
dbVal, err := filepath.EvalSymlinks(dbValue)
|
||||
if err != nil && !errors.Is(err, fs.ErrNotExist) {
|
||||
checkedVal, err := evalSymlinksIfExists(dbValue)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("evaluating symlinks on DB %s path %q: %w", toCheck.name, dbValue, err)
|
||||
}
|
||||
dbValue = dbVal
|
||||
dbValue = checkedVal
|
||||
}
|
||||
if ourValue != "" {
|
||||
ourVal, err := filepath.EvalSymlinks(ourValue)
|
||||
if err != nil && !errors.Is(err, fs.ErrNotExist) {
|
||||
checkedVal, err := evalSymlinksIfExists(ourValue)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("evaluating symlinks on configured %s path %q: %w", toCheck.name, ourValue, err)
|
||||
}
|
||||
ourValue = ourVal
|
||||
ourValue = checkedVal
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user