Skip to content

Commit c007b14

Browse files
committed
fix op
1 parent d6c8064 commit c007b14

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

vm/src/stdlib/os.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ pub fn os_open(vm: &VirtualMachine, args: PyFuncArgs) -> PyResult {
132132
fn _set_file_model(flags: &PyObjectRef) -> OpenOptions {
133133
let flags = objint::get_value(flags).to_i32().unwrap();
134134
let mut options = OpenOptions::new();
135-
options.read(flags & libc::O_RDONLY != 0);
135+
options.read(flags == libc::O_RDONLY);
136136
options.write(flags & libc::O_WRONLY != 0);
137137
options.append(flags & libc::O_APPEND != 0);
138138
options.custom_flags(flags);
@@ -143,7 +143,7 @@ fn _set_file_model(flags: &PyObjectRef) -> OpenOptions {
143143
fn _set_file_model(flags: &PyObjectRef) -> OpenOptions {
144144
let flags = objint::get_value(flags).to_u32().unwrap();
145145
let mut options = OpenOptions::new();
146-
options.read((flags as i32) & libc::O_RDONLY != libc::O_RDONLY);
146+
options.read((flags as i32) == libc::O_RDONLY);
147147
options.write((flags as i32) & libc::O_WRONLY != 0);
148148
options.append((flags as i32) & libc::O_APPEND != 0);
149149
options.custom_flags(flags);

0 commit comments

Comments
 (0)