unix: return ECONNREFUSE if a socket file exists but a socket isn't bound to it

PiperOrigin-RevId: 328843560
This commit is contained in:
Andrei Vagin
2020-08-27 16:52:02 -07:00
committed by gVisor bot
parent 57877b420c
commit dc008fbbcc
3 changed files with 25 additions and 1 deletions
+3
View File
@@ -783,6 +783,9 @@ func (fs *filesystem) BoundEndpointAt(ctx context.Context, rp *vfs.ResolvingPath
}
switch impl := d.inode.impl.(type) {
case *socketFile:
if impl.ep == nil {
return nil, syserror.ECONNREFUSED
}
return impl.ep, nil
default:
return nil, syserror.ECONNREFUSED