diff options
author | Baptiste Courtois <b.courtois@criteo.com> | 2015-08-21 15:13:56 +0200 |
---|---|---|
committer | Bryan McLellan <btm@loftninjas.org> | 2017-01-21 10:46:55 -0500 |
commit | 5b1fe5d74ceeaa89bb5153c0e43c7acecd9b3720 (patch) | |
tree | c81418de1b230e4e7c53bfbb7a2bddb38351ac89 /lib/chef/win32 | |
parent | 8c68a52473831c14886a1568ca15eead0ea7af23 (diff) | |
download | chef-5b1fe5d74ceeaa89bb5153c0e43c7acecd9b3720.tar.gz |
Raise NamedSecurityInfo related exception using HR result
GetNamedSecurityInfoW & SetNamedSecurityInfoW returns error code (HR)
So pass the HR code to Win32::Error.raise! to avoid this weird message:
> ---- Begin Win32 API output ----
> System Error Code: 0
> System Error Message: The operation completed successfully.
> ---- End Win32 API output ----
Diffstat (limited to 'lib/chef/win32')
-rw-r--r-- | lib/chef/win32/security.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/win32/security.rb b/lib/chef/win32/security.rb index 8bf2bfa762..c7d3f55a40 100644 --- a/lib/chef/win32/security.rb +++ b/lib/chef/win32/security.rb @@ -239,7 +239,7 @@ class Chef security_descriptor = FFI::MemoryPointer.new :pointer hr = GetNamedSecurityInfoW(path.to_wstring, type, info, nil, nil, nil, nil, security_descriptor) if hr != ERROR_SUCCESS - Chef::ReservedNames::Win32::Error.raise!("get_named_security_info(#{path}, #{type}, #{info})") + Chef::ReservedNames::Win32::Error.raise!("get_named_security_info(#{path}, #{type}, #{info})", hr) end result_pointer = security_descriptor.read_pointer @@ -538,7 +538,7 @@ class Chef hr = SetNamedSecurityInfoW(path.to_wstring, type, security_information, owner, group, dacl, sacl) if hr != ERROR_SUCCESS - Chef::ReservedNames::Win32::Error.raise! + Chef::ReservedNames::Win32::Error.raise! nil, hr end end |