branch Attitude Adjustment packages
[12.09/packages.git] / net / openssh / patches / 140-pam_uclibc_pthreads_fix.patch
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  
14  /* ARGSUSED */
15  static void
16 -pthread_exit(void *value)
17 +pthread2_exit(void *value)
18  {
19         _exit(0);
20  }
21  
22  /* ARGSUSED */
23  static int
24 -pthread_create(sp_pthread_t *thread, const void *attr,
25 +pthread2_create(sp_pthread_t *thread, const void *attr,
26      void *(*thread_start)(void *), void *arg)
27  {
28         pid_t pid;
29 @@ -201,7 +201,7 @@ pthread_create(sp_pthread_t *thread, con
30  }
31  
32  static int
33 -pthread_cancel(sp_pthread_t thread)
34 +pthread2_cancel(sp_pthread_t thread)
35  {
36         signal(SIGCHLD, sshpam_oldsig);
37         return (kill(thread, SIGTERM));
38 @@ -209,7 +209,7 @@ pthread_cancel(sp_pthread_t thread)
39  
40  /* ARGSUSED */
41  static int
42 -pthread_join(sp_pthread_t thread, void **value)
43 +pthread2_join(sp_pthread_t thread, void **value)
44  {
45         int status;
46  
47 @@ -509,7 +509,7 @@ sshpam_thread(void *ctxtp)
48         /* XXX - can't do much about an error here */
49         ssh_msg_send(ctxt->pam_csock, sshpam_err, &buffer);
50         buffer_free(&buffer);
51 -       pthread_exit(NULL);
52 +       pthread2_exit(NULL);
53  
54   auth_fail:
55         buffer_put_cstring(&buffer,
56 @@ -520,7 +520,7 @@ sshpam_thread(void *ctxtp)
57         else
58                 ssh_msg_send(ctxt->pam_csock, PAM_AUTH_ERR, &buffer);
59         buffer_free(&buffer);
60 -       pthread_exit(NULL);
61 +       pthread2_exit(NULL);
62  
63         return (NULL); /* Avoid warning for non-pthread case */
64  }
65 @@ -532,8 +532,8 @@ sshpam_thread_cleanup(void)
66  
67         debug3("PAM: %s entering", __func__);
68         if (ctxt != NULL && ctxt->pam_thread != 0) {
69 -               pthread_cancel(ctxt->pam_thread);
70 -               pthread_join(ctxt->pam_thread, NULL);
71 +               pthread2_cancel(ctxt->pam_thread);
72 +               pthread2_join(ctxt->pam_thread, NULL);
73                 close(ctxt->pam_psock);
74                 close(ctxt->pam_csock);
75                 memset(ctxt, 0, sizeof(*ctxt));
76 @@ -698,7 +698,7 @@ sshpam_init_ctx(Authctxt *authctxt)
77         }
78         ctxt->pam_psock = socks[0];
79         ctxt->pam_csock = socks[1];
80 -       if (pthread_create(&ctxt->pam_thread, NULL, sshpam_thread, ctxt) == -1) {
81 +       if (pthread2_create(&ctxt->pam_thread, NULL, sshpam_thread, ctxt) == -1) {
82                 error("PAM: failed to start authentication thread: %s",
83                     strerror(errno));
84                 close(socks[0]);