140-pam_uclibc_pthreads_fix.patch 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. --- a/auth-pam.c
  2. +++ b/auth-pam.c
  3. @@ -159,7 +159,7 @@ sshpam_sigchld_handler(int sig)
  4. }
  5. if (WIFSIGNALED(sshpam_thread_status) &&
  6. WTERMSIG(sshpam_thread_status) == SIGTERM)
  7. - return; /* terminated by pthread_cancel */
  8. + return; /* terminated by pthread2_cancel */
  9. if (!WIFEXITED(sshpam_thread_status))
  10. sigdie("PAM: authentication thread exited unexpectedly");
  11. if (WEXITSTATUS(sshpam_thread_status) != 0)
  12. @@ -168,14 +168,14 @@ sshpam_sigchld_handler(int sig)
  13. /* ARGSUSED */
  14. static void
  15. -pthread_exit(void *value)
  16. +pthread2_exit(void *value)
  17. {
  18. _exit(0);
  19. }
  20. /* ARGSUSED */
  21. static int
  22. -pthread_create(sp_pthread_t *thread, const void *attr,
  23. +pthread2_create(sp_pthread_t *thread, const void *attr,
  24. void *(*thread_start)(void *), void *arg)
  25. {
  26. pid_t pid;
  27. @@ -201,7 +201,7 @@ pthread_create(sp_pthread_t *thread, con
  28. }
  29. static int
  30. -pthread_cancel(sp_pthread_t thread)
  31. +pthread2_cancel(sp_pthread_t thread)
  32. {
  33. signal(SIGCHLD, sshpam_oldsig);
  34. return (kill(thread, SIGTERM));
  35. @@ -209,7 +209,7 @@ pthread_cancel(sp_pthread_t thread)
  36. /* ARGSUSED */
  37. static int
  38. -pthread_join(sp_pthread_t thread, void **value)
  39. +pthread2_join(sp_pthread_t thread, void **value)
  40. {
  41. int status;
  42. @@ -510,7 +510,7 @@ sshpam_thread(void *ctxtp)
  43. /* XXX - can't do much about an error here */
  44. ssh_msg_send(ctxt->pam_csock, sshpam_err, &buffer);
  45. buffer_free(&buffer);
  46. - pthread_exit(NULL);
  47. + pthread2_exit(NULL);
  48. auth_fail:
  49. buffer_put_cstring(&buffer,
  50. @@ -521,7 +521,7 @@ sshpam_thread(void *ctxtp)
  51. else
  52. ssh_msg_send(ctxt->pam_csock, PAM_AUTH_ERR, &buffer);
  53. buffer_free(&buffer);
  54. - pthread_exit(NULL);
  55. + pthread2_exit(NULL);
  56. return (NULL); /* Avoid warning for non-pthread case */
  57. }
  58. @@ -533,8 +533,8 @@ sshpam_thread_cleanup(void)
  59. debug3("PAM: %s entering", __func__);
  60. if (ctxt != NULL && ctxt->pam_thread != 0) {
  61. - pthread_cancel(ctxt->pam_thread);
  62. - pthread_join(ctxt->pam_thread, NULL);
  63. + pthread2_cancel(ctxt->pam_thread);
  64. + pthread2_join(ctxt->pam_thread, NULL);
  65. close(ctxt->pam_psock);
  66. close(ctxt->pam_csock);
  67. memset(ctxt, 0, sizeof(*ctxt));
  68. @@ -698,7 +698,7 @@ sshpam_init_ctx(Authctxt *authctxt)
  69. }
  70. ctxt->pam_psock = socks[0];
  71. ctxt->pam_csock = socks[1];
  72. - if (pthread_create(&ctxt->pam_thread, NULL, sshpam_thread, ctxt) == -1) {
  73. + if (pthread2_create(&ctxt->pam_thread, NULL, sshpam_thread, ctxt) == -1) {
  74. error("PAM: failed to start authentication thread: %s",
  75. strerror(errno));
  76. close(socks[0]);