Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 96095 invoked from network); 8 Aug 2009 11:03:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Aug 2009 11:03:02 -0000 Received: (qmail 65998 invoked by uid 500); 8 Aug 2009 11:03:09 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 65911 invoked by uid 500); 8 Aug 2009 11:03:09 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 65897 invoked by uid 99); 8 Aug 2009 11:03:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 Aug 2009 11:03:09 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 Aug 2009 11:03:07 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 04B792388985; Sat, 8 Aug 2009 11:02:47 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r802339 - in /commons/sandbox/runtime/trunk/src/main/native/os/win32: main.c syslog.c Date: Sat, 08 Aug 2009 11:02:46 -0000 To: commits@commons.apache.org From: mturk@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090808110247.04B792388985@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: mturk Date: Sat Aug 8 11:02:46 2009 New Revision: 802339 URL: http://svn.apache.org/viewvc?rev=802339&view=rev Log: Fix privilge logging Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c commons/sandbox/runtime/trunk/src/main/native/os/win32/syslog.c Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c?rev=802339&r1=802338&r2=802339&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c (original) +++ commons/sandbox/runtime/trunk/src/main/native/os/win32/main.c Sat Aug 8 11:02:46 2009 @@ -235,7 +235,7 @@ DWORD rc; JNIEnv *env; void *epp; - const wchar_t *pp; + const wchar_t **pp = &sePrivileges[0]; UNREFERENCED(reserved); if ((*vm)->GetEnv(vm, &epp, JNI_VERSION_1_4)) { @@ -259,12 +259,15 @@ if ((dll_tls_index = TlsAlloc()) == TLS_OUT_OF_INDEXES) { return JNI_ERR; } - for (pp = sePrivileges[0]; pp; pp++) { - if ((rc = ACR_EnablePrivilege(pp)) != ERROR_SUCCESS) { + while (*pp) { + if ((rc = ACR_EnablePrivilege(*pp)) != ERROR_SUCCESS) { + WCHAR buf[128]; + swprintf(buf, L"Failed enabling %s", *pp); /* Log that we couldn't set privilege */ acr_init_log_source(LOG_MSG_DOMAIN); - do_syslog(ACR_LOG_ERROR, pp, rc); + do_syslog(ACR_LOG_WARN, buf, rc); } + ++pp; } env = epp; Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/syslog.c URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/syslog.c?rev=802339&r1=802338&r2=802339&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/os/win32/syslog.c (original) +++ commons/sandbox/runtime/trunk/src/main/native/os/win32/syslog.c Sat Aug 8 11:02:46 2009 @@ -38,8 +38,8 @@ DWORD id = LOG_MSG_DEBUG; WORD il = EVENTLOG_SUCCESS; HANDLE source; - WCHAR *messages[2]; - WCHAR buffer[ACR_MBUFF_SIZ]; + WCHAR *messages[2] = { NULL, NULL}; + WCHAR buffer[ACR_MBUFF_SIZ] = L""; WORD nStrings = 1; switch (level) { @@ -67,8 +67,7 @@ messages[0] = msg; if (err) { - FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | + FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err,