Skip to content

Commit

Permalink
rc: avoid additional syscall
Browse files Browse the repository at this point in the history
re-use the file descriptor to get the stat info out of the file
  • Loading branch information
zimbatm committed Apr 17, 2022
1 parent 66b0691 commit c8c1074
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/cmd/rc.go
Expand Up @@ -249,7 +249,7 @@ func fileExists(path string) bool {
f.Close()

// Next, check that the file is a regular file.
fi, err := os.Stat(path)
fi, err := f.Stat()
if err != nil {
return false
}
Expand Down

0 comments on commit c8c1074

Please sign in to comment.