commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
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 GMT
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,



Mime
View raw message