Skip to content

Commit 1980fdd

Browse files
committed
Handle wrapped errors correctly in libcontainer/init_linux.go
Signed-off-by: Curd Becker <me@curd-becker.de>
1 parent e0adafb commit 1980fdd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libcontainer/init_linux.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ func finalizeNamespace(config *initConfig) error {
314314
switch {
315315
case err == nil:
316316
doChdir = false
317-
case os.IsPermission(err):
317+
case errors.Is(err, os.ErrPermission):
318318
// If we hit an EPERM, we should attempt again after setting up user.
319319
// This will allow us to successfully chdir if the container user has access
320320
// to the directory, but the user running runc does not.
@@ -480,7 +480,7 @@ func setupUser(config *initConfig) error {
480480
setgroups, err = io.ReadAll(setgroupsFile)
481481
_ = setgroupsFile.Close()
482482
}
483-
if err != nil && !os.IsNotExist(err) {
483+
if err != nil && !errors.Is(err, os.ErrNotExist) {
484484
return err
485485
}
486486

0 commit comments

Comments
 (0)