mirror of
https://github.com/containers/podman.git
synced 2025-12-11 09:18:34 +08:00
Update containers/storage to v1.16.5
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
17
vendor/github.com/containers/storage/pkg/fileutils/fileutils.go
generated
vendored
17
vendor/github.com/containers/storage/pkg/fileutils/fileutils.go
generated
vendored
@@ -1,7 +1,6 @@
|
||||
package fileutils
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
@@ -10,6 +9,7 @@ import (
|
||||
"strings"
|
||||
"text/scanner"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@@ -358,6 +358,21 @@ func ReadSymlinkedDirectory(path string) (string, error) {
|
||||
return realPath, nil
|
||||
}
|
||||
|
||||
// ReadSymlinkedPath returns the target directory of a symlink.
|
||||
// The target of the symbolic link can be a file and a directory.
|
||||
func ReadSymlinkedPath(path string) (realPath string, err error) {
|
||||
if realPath, err = filepath.Abs(path); err != nil {
|
||||
return "", errors.Wrapf(err, "unable to get absolute path for %q", path)
|
||||
}
|
||||
if realPath, err = filepath.EvalSymlinks(realPath); err != nil {
|
||||
return "", errors.Wrapf(err, "failed to canonicalise path for %q", path)
|
||||
}
|
||||
if _, err := os.Stat(realPath); err != nil {
|
||||
return "", errors.Wrapf(err, "failed to stat target %q of %q", realPath, path)
|
||||
}
|
||||
return realPath, nil
|
||||
}
|
||||
|
||||
// CreateIfNotExists creates a file or a directory only if it does not already exist.
|
||||
func CreateIfNotExists(path string, isDir bool) error {
|
||||
if _, err := os.Stat(path); err != nil {
|
||||
|
||||
3
vendor/github.com/containers/storage/pkg/mount/mount.go
generated
vendored
3
vendor/github.com/containers/storage/pkg/mount/mount.go
generated
vendored
@@ -56,10 +56,11 @@ func Mounted(mountpoint string) (bool, error) {
|
||||
return false, err
|
||||
}
|
||||
|
||||
mountpoint, err = fileutils.ReadSymlinkedDirectory(mountpoint)
|
||||
mountpoint, err = fileutils.ReadSymlinkedPath(mountpoint)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
// Search the table for the mountpoint
|
||||
for _, e := range entries {
|
||||
if e.Mountpoint == mountpoint {
|
||||
|
||||
2
vendor/github.com/containers/storage/pkg/system/process_unix.go
generated
vendored
2
vendor/github.com/containers/storage/pkg/system/process_unix.go
generated
vendored
@@ -20,5 +20,5 @@ func IsProcessAlive(pid int) bool {
|
||||
|
||||
// KillProcess force-stops a process.
|
||||
func KillProcess(pid int) {
|
||||
unix.Kill(pid, unix.SIGKILL)
|
||||
_ = unix.Kill(pid, unix.SIGKILL)
|
||||
}
|
||||
|
||||
5
vendor/github.com/containers/storage/pkg/system/rm.go
generated
vendored
5
vendor/github.com/containers/storage/pkg/system/rm.go
generated
vendored
@@ -7,6 +7,7 @@ import (
|
||||
|
||||
"github.com/containers/storage/pkg/mount"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// EnsureRemoveAll wraps `os.RemoveAll` to check for specific errors that can
|
||||
@@ -29,7 +30,9 @@ func EnsureRemoveAll(dir string) error {
|
||||
maxRetry := 100
|
||||
|
||||
// Attempt to unmount anything beneath this dir first
|
||||
mount.RecursiveUnmount(dir)
|
||||
if err := mount.RecursiveUnmount(dir); err != nil {
|
||||
logrus.Debugf("RecusiveUnmount on %s failed: %v", dir, err)
|
||||
}
|
||||
|
||||
for {
|
||||
err := os.RemoveAll(dir)
|
||||
|
||||
Reference in New Issue
Block a user