Skip to content

Commit

Permalink
fix ENOENT error because of TOCTOU
Browse files Browse the repository at this point in the history
  • Loading branch information
yuuki committed Mar 14, 2021
1 parent aba5af2 commit 93be553
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion netutil/netutil_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,9 @@ func BuildUserEntries() (UserEnts, error) {
fi, err := os.Stat(fdDir)
switch {
case err != nil:
return nil, xerrors.Errorf("stat %s: %v", fdDir, err)
// ignore ENOENT error
// ENOENT error occurs when the fd has already closed due to short-lived connection
continue
case !fi.IsDir():
continue
}
Expand Down

0 comments on commit 93be553

Please sign in to comment.