Skip to content

Commit

Permalink
runtime: don't fail mkdir if the folder is already created
Browse files Browse the repository at this point in the history
Use MkdirAll instead of Mkdir so it doesn't generate an
error when the folder is created by another process

Fixes #5713

Signed-off-by: Alexandru Matei <alexandru.matei@uipath.com>
  • Loading branch information
alex-matei committed Nov 24, 2022
1 parent 7c8d474 commit 4b45e13
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/runtime/virtcontainers/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ func MkdirAllWithInheritedOwner(path string, perm os.FileMode) error {
info, err := os.Stat(curPath)

if err != nil {
if err = os.Mkdir(curPath, perm); err != nil {
if err = os.MkdirAll(curPath, perm); err != nil {
return fmt.Errorf("mkdir call failed: %v", err.Error())
}
if err = syscall.Chown(curPath, uid, gid); err != nil {
Expand Down

0 comments on commit 4b45e13

Please sign in to comment.