Clear the error pointer so that it may be reused.

This commit is contained in:
Patrick Mahoney 2011-12-17 07:53:15 -06:00
parent 514df0f49f
commit f65ae434e4
1 changed files with 5 additions and 1 deletions

View File

@ -23,6 +23,9 @@ module ProcessShared
# Replace methods in `syms` with error checking wrappers that
# invoke the original psem method and raise an appropriate
# error.
#
# The last argument is assumed to be a pointer to a pointer
# where either a psem error or NULL will be stored.
def psem_error_check(*syms)
syms.each do |sym|
method = self.method(sym)
@ -32,7 +35,8 @@ module ProcessShared
errp = args[-1]
unless errp.nil?
begin
err = Error.new(errp.get_pointer(0))
err = Error.new(errp.read_pointer)
errp.write_pointer(nil)
if err[:source] == PSem.e_source_system
raise SystemCallError.new("error in #{sym}", err[:errno])
else