diff options
author | Wan-Teh Chang <wtc@google.com> | 2013-12-18 16:08:54 -0800 |
---|---|---|
committer | Wan-Teh Chang <wtc@google.com> | 2013-12-18 16:08:54 -0800 |
commit | a4e50f0a052b4ad39591275add5ea4823d51f212 (patch) | |
tree | e24afacc5fd69627fa7d3e3b6a8e3333b6243aa2 /cmd/strsclnt | |
parent | 6c408459126826e2064180e14ea66edbff194337 (diff) | |
download | nss-hg-a4e50f0a052b4ad39591275add5ea4823d51f212.tar.gz |
Bug 951816: Improve error reporting of PR_Connect failure. r=brian.
Diffstat (limited to 'cmd/strsclnt')
-rw-r--r-- | cmd/strsclnt/strsclnt.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cmd/strsclnt/strsclnt.c b/cmd/strsclnt/strsclnt.c index 7ab0aa5d6..26b8f92cc 100644 --- a/cmd/strsclnt/strsclnt.c +++ b/cmd/strsclnt/strsclnt.c @@ -180,10 +180,11 @@ static void errWarn(char * funcString) { PRErrorCode perr = PR_GetError(); + PRInt32 oserr = PR_GetOSError(); const char * errString = SECU_Strerror(perr); - fprintf(stderr, "strsclnt: %s returned error %d:\n%s\n", - funcString, perr, errString); + fprintf(stderr, "strsclnt: %s returned error %d, OS error %d: %s\n", + funcString, perr, oserr, errString); } static void @@ -765,11 +766,13 @@ retry: prStatus = PR_Connect(tcp_sock, addr, PR_INTERVAL_NO_TIMEOUT); if (prStatus != PR_SUCCESS) { PRErrorCode err = PR_GetError(); /* save error code */ + PRInt32 oserr = PR_GetOSError(); if (ThrottleUp) { PRTime now = PR_Now(); PR_Lock(threadLock); lastConnectFailure = PR_MAX(now, lastConnectFailure); PR_Unlock(threadLock); + PR_SetError(err, oserr); /* restore error code */ } if ((err == PR_CONNECT_REFUSED_ERROR) || (err == PR_CONNECT_RESET_ERROR) ) { |