mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 14:03:58 +00:00
Fix read_blocked
This caused math to assert out because it never wrote into the buffer. Now, presumably it wrote somewhere but I don't know where, so fixing this seems like a good idea. Fixes #9735.
This commit is contained in:
parent
1bf29a5e13
commit
3bfe798dbb
2 changed files with 5 additions and 2 deletions
|
@ -1433,9 +1433,9 @@ fn can_be_encoded(wc: char) -> bool {
|
|||
|
||||
/// Call read, blocking and repeating on EINTR. Exits on EAGAIN.
|
||||
/// \return the number of bytes read, or 0 on EOF. On EAGAIN, returns -1 if nothing was read.
|
||||
pub fn read_blocked(fd: RawFd, mut buf: &mut [u8]) -> isize {
|
||||
pub fn read_blocked(fd: RawFd, buf: &mut [u8]) -> isize {
|
||||
loop {
|
||||
let res = unsafe { libc::read(fd, std::ptr::addr_of_mut!(buf).cast(), buf.len()) };
|
||||
let res = unsafe { libc::read(fd, buf.as_mut_ptr().cast(), buf.len()) };
|
||||
if res < 0 && errno::errno().0 == EINTR {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -335,3 +335,6 @@ math 0x0_2.0_0_0P0_2
|
|||
# CHECK: 8
|
||||
math -0x8p-0_3
|
||||
# CHECK: -1
|
||||
|
||||
echo 5 + 6 | math
|
||||
# CHECK: 11
|
||||
|
|
Loading…
Reference in a new issue