pam_tacplus icon indicating copy to clipboard operation
pam_tacplus copied to clipboard

Use __thread (thread-local storage) keyword for pthread-safe

Open kyeongy opened this issue 6 years ago • 1 comments

C99 supports Thread-Local Storage: https://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Thread_002dLocal.html

This patch makes use of "__thread" storage class keyword to make the code pthread-safe without changing the code much:

  • Changed all global variables which can be modified by multiple threads
  • Changed static varible in tac_ntop()
  • Removed unnecessary "static" from local variable in _pam_account()

kyeongy avatar Feb 28 '18 22:02 kyeongy

Hi @kyeongy did you test if it works on older compilers as well?

kravietz avatar Dec 13 '18 12:12 kravietz