[openssh-commits] [openssh] 01/02: pthread_create(3) returns positive values on failure.

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Jun 7 22:52:35 AEST 2019


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit 1bd4f7f25f653e0cadb2e6f25d79bc3c35c6aa4d
Author: Elliott Hughes <enh at google.com>
Date:   Thu Apr 25 13:36:27 2019 -0700

    pthread_create(3) returns positive values on failure.
    
    Found by inspection after finding similar bugs in other code used by
    Android.
---
 auth-pam.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/auth-pam.c b/auth-pam.c
index 289d9f4f..8efd7b67 100644
--- a/auth-pam.c
+++ b/auth-pam.c
@@ -777,6 +777,7 @@ sshpam_init_ctx(Authctxt *authctxt)
 {
 	struct pam_ctxt *ctxt;
 	int socks[2];
+	int result;
 
 	debug3("PAM: %s entering", __func__);
 	/*
@@ -803,9 +804,10 @@ sshpam_init_ctx(Authctxt *authctxt)
 	}
 	ctxt->pam_psock = socks[0];
 	ctxt->pam_csock = socks[1];
-	if (pthread_create(&ctxt->pam_thread, NULL, sshpam_thread, ctxt) == -1) {
+	result = pthread_create(&ctxt->pam_thread, NULL, sshpam_thread, ctxt);
+	if (result != 0) {
 		error("PAM: failed to start authentication thread: %s",
-		    strerror(errno));
+		    strerror(result));
 		close(socks[0]);
 		close(socks[1]);
 		free(ctxt);

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list