---------- Forwarded message ---------- Date: Sun, 13 Sep 2009 10:49:06 +0200 (CEST) From: Julia Lawall <ju...@diku.dk> Reply-To: openssl-dev@openssl.org To: openssl-dev@openssl.org, Rene Rydhof Hansen <r...@cs.aau.dk>, Gilles Muller - lip6 <gilles.mul...@lip6.fr>, z...@google.com Subject: [PATCH] OPENSSL_isservice usage
The function OPENSSL_isservice can return -1 in the case of error. This code appears to be interested in the case where the call succeeds. Thus, I have converted the test on the result to > 0. Alternatively, since OPENSSL_isservice can only return -1, 0, or 1, the call could be converted to OPENSSL_isservice() == 1. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @expression@ expression list args; @@ - OPENSSL_isservice(args) == 0 + OPENSSL_isservice(args) <= 0 || ... @expression@ expression list args; @@ - OPENSSL_isservice(args) != 0 + OPENSSL_isservice(args) > 0 || ... // </smpl> --- diff -u -p a/crypto/cryptlib.c b/crypto/cryptlib.c --- a/crypto/cryptlib.c 2009-07-28 00:04:54.000000000 +0200 +++ b/crypto/cryptlib.c 2009-09-12 11:26:07.000000000 +0200 @@ -847,7 +847,7 @@ void OPENSSL_showfatal (const char *fmta #if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333 /* this -------------v--- guards NT-specific calls */ - if (GetVersion() < 0x80000000 && OPENSSL_isservice()) + if (GetVersion() < 0x80000000 && OPENSSL_isservice() > 0) { HANDLE h = RegisterEventSource(0,_T("OPENSSL")); const TCHAR *pmsg=buf; ReportEvent(h,EVENTLOG_ERROR_TYPE,0,0,0,1,0,&pmsg,0); ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List openssl-dev@openssl.org Automated List Manager majord...@openssl.org ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List openssl-dev@openssl.org Automated List Manager majord...@openssl.org