Skip to content

Commit

Permalink
Merge pull request #351 from doronz88/bugfix/thread-local-errno
Browse files Browse the repository at this point in the history
darwin: override `errno` to be thread-local
  • Loading branch information
doronz88 authored Apr 1, 2024
2 parents 801ef04 + 433f4b8 commit 18f3866
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/rpcclient/rpcclient/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,11 @@ def symbol(self, symbol: int):
return Symbol.create(symbol, self)

@property
def errno(self):
def errno(self) -> int:
return self.symbols.errno[0]

@errno.setter
def errno(self, value):
def errno(self, value: int) -> None:
self.symbols.errno[0] = value

@property
Expand Down
12 changes: 12 additions & 0 deletions src/rpcclient/rpcclient/darwin/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,18 @@ def interactive(self, additional_namespace: typing.Mapping = None):
additional_namespace['CFSTR'] = self.cf
super().interactive(additional_namespace=additional_namespace)

@property
def errno(self) -> int:
p_error = self.symbols['__error']()
p_error.item_size = 4
return p_error[0]

@errno.setter
def errno(self, value: int) -> None:
p_error = self.symbols['__error']()
p_error.item_size = 4
p_error[0] = value

@property
def images(self) -> typing.List[DyldImage]:
m = []
Expand Down

0 comments on commit 18f3866

Please sign in to comment.