summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaptiste Courtois <b.courtois@criteo.com>2015-08-21 15:13:56 +0200
committerBryan McLellan <btm@loftninjas.org>2017-01-21 10:46:55 -0500
commit5b1fe5d74ceeaa89bb5153c0e43c7acecd9b3720 (patch)
treec81418de1b230e4e7c53bfbb7a2bddb38351ac89
parent8c68a52473831c14886a1568ca15eead0ea7af23 (diff)
downloadchef-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 ----
-rw-r--r--lib/chef/win32/security.rb4
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