Skip to content

Commit

Permalink
Fix SECURITY_SQOS_PRESENT missing
Browse files Browse the repository at this point in the history
if security_qos_flags(SECURITY_ANONYMOUS) is set
  • Loading branch information
pitdicker committed Feb 15, 2019
1 parent f47ec2a commit 503e74e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/libstd/sys/windows/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,11 @@ impl OpenOptions {
pub fn access_mode(&mut self, access_mode: u32) { self.access_mode = Some(access_mode); }
pub fn share_mode(&mut self, share_mode: u32) { self.share_mode = share_mode; }
pub fn attributes(&mut self, attrs: u32) { self.attributes = attrs; }
pub fn security_qos_flags(&mut self, flags: u32) { self.security_qos_flags = flags; }
pub fn security_qos_flags(&mut self, flags: u32) {
// We have to set `SECURITY_SQOS_PRESENT` here, because one of the valid flags we can
// receive is `SECURITY_ANONYMOUS = 0x0`, which we can't check for later on.
self.security_qos_flags = flags | c::SECURITY_SQOS_PRESENT;
}
pub fn security_attributes(&mut self, attrs: c::LPSECURITY_ATTRIBUTES) {
self.security_attributes = attrs as usize;
}
Expand Down Expand Up @@ -239,7 +243,6 @@ impl OpenOptions {
self.custom_flags |
self.attributes |
self.security_qos_flags |
if self.security_qos_flags != 0 { c::SECURITY_SQOS_PRESENT } else { 0 } |
if self.create_new { c::FILE_FLAG_OPEN_REPARSE_POINT } else { 0 }
}
}
Expand Down

0 comments on commit 503e74e

Please sign in to comment.