Skip to content

Commit

Permalink
Replace errant Stat with Lstat
Browse files Browse the repository at this point in the history
  • Loading branch information
DUOLabs333 committed Dec 23, 2023
1 parent 8c96866 commit b83229f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion create.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (fs OverlayFS) createErrorCheck(path string) {
}

func (fs OverlayFS) Rename(oldpath, newpath string) error{

fmt.Println("Rename: ",newpath)
old,err:=fs.Open(oldpath)
if err!=nil{
return err
Expand All @@ -34,6 +34,7 @@ func (fs OverlayFS) Rename(oldpath, newpath string) error{

if fs.getModeofFirstExisting(oldpath)=="RO"{
_,err:=io.Copy(new,old)
new.Close()
fs.Remove(oldpath)
return err
}
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (fs OverlayFS) OpenFile(filename string, flag int, perm os.FileMode) (billy
COWPath=create_path
}

fileStat,_:=os.Stat(originalPath)
fileStat,_:=os.Lstat(originalPath)
fileMode:=fileStat.Mode()
isRegular := fileMode.IsRegular()
isSymlink := (fileMode & fs1.ModeSymlink != 0)
Expand Down

0 comments on commit b83229f

Please sign in to comment.