-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
std: sys: fs: uefi: Implement File::read #150853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
r? @ibraheemdev rustbot has assigned @ibraheemdev. Use |
library/std/src/sys/fs/uefi.rs
Outdated
|
|
||
| let r = unsafe { ((*file_ptr).read)(file_ptr, &mut buf_size, buf.as_mut_ptr().cast()) }; | ||
|
|
||
| if r.is_error() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be
| if r.is_error() { | |
| if buf_size != 0 && r.is_error() { |
since io::Read requires that
If an error is returned then it must be guaranteed that no bytes were read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be if buf_size == 0 && r.is_error(). I think you want to guard against partial reads right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yes, indeed.
|
Reminder, once the PR becomes ready for a review, use |
cbc8fad to
5725bd1
Compare
|
@rustbot ready |
Tested using OVMF on QEMU. Signed-off-by: Ayush Singh <ayush@beagleboard.org>
5725bd1 to
fd59b32
Compare
|
@bors r+ |
Rollup of 9 pull requests Successful merges: - #149318 (Implement partial_sort_unstable for slice) - #150805 (Fix ICE in inline always warning emission.) - #150822 (Fix for ICE: eii: fn / macro rules None in find_attr()) - #150853 (std: sys: fs: uefi: Implement File::read) - #150855 (std: sys: fs: uefi: Implement File::tell) - #150881 (Fix std::fs::copy on WASI by setting proper OpenOptions flags) - #150891 (Fix a trivial typo in def_id.rs) - #150892 (Don't check `[mentions]` paths in submodules from tidy) - #150894 (cg_llvm: add a pause to make comment less confusing) r? @ghost
Tested using OVMF on QEMU.
@rustbot label +O-UEFI