add a check for connectivity in get_peer_name

This commit is contained in:
Benton60
2026-04-06 13:22:08 -04:00
parent 5d1981bf23
commit 5fc7dc360a
+5 -1
View File
@@ -383,7 +383,11 @@ impl<'a> SchemeSocket for UdpSocket<'a> {
file: &SchemeFile<Self>,
buf: &mut [u8],
) -> SyscallResult<usize> {
self.fpath(file, buf)
if self.endpoint().is_specified() {
return self.fpath(file, buf)
} else {
return Err(SyscallError::new(syscall::ENOTCONN));
}
}
fn handle_shutdown(&mut self, file: &mut SchemeFile<Self>, how: usize) -> SyscallResult<usize> {