You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2011/06/23 17:30:21 UTC
svn commit: r1138933 - in /commons/proper/daemon/trunk/src/native/windows:
apps/prunmgr/prunmgr.c src/service.c
Author: mturk
Date: Thu Jun 23 15:30:21 2011
New Revision: 1138933
URL: http://svn.apache.org/viewvc?rev=1138933&view=rev
Log:
DAEMON-205 Do not display error if its ACCESS_DENIED. This means the user has no privileges so just silently quit
Modified:
commons/proper/daemon/trunk/src/native/windows/apps/prunmgr/prunmgr.c
commons/proper/daemon/trunk/src/native/windows/src/service.c
Modified: commons/proper/daemon/trunk/src/native/windows/apps/prunmgr/prunmgr.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/windows/apps/prunmgr/prunmgr.c?rev=1138933&r1=1138932&r2=1138933&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/windows/apps/prunmgr/prunmgr.c (original)
+++ commons/proper/daemon/trunk/src/native/windows/apps/prunmgr/prunmgr.c Thu Jun 23 15:30:21 2011
@@ -1642,6 +1642,8 @@ int WINAPI WinMain(HINSTANCE hInstance,
bEnableTry = TRUE;
hService = apxCreateService(hPool, SC_MANAGER_CONNECT, FALSE);
if (IS_INVALID_HANDLE(hService)) {
+ if (GetLastError() == ERROR_ACCESS_DENIED)
+ quiet = TRUE;
if (!quiet)
apxDisplayError(TRUE, NULL, 0, "Unable to open the Service Manager");
goto cleanup;
@@ -1656,7 +1658,8 @@ int WINAPI WinMain(HINSTANCE hInstance,
SERVICE_ALL_ACCESS)) {
if (!apxServiceOpen(hService, lpCmdline->szApplication,
GENERIC_READ | GENERIC_EXECUTE)) {
-
+ if (GetLastError() == ERROR_ACCESS_DENIED)
+ quiet = TRUE;
if (!quiet)
apxDisplayError(TRUE, NULL, 0, "Unable to open the service '%S'",
lpCmdline->szApplication);
Modified: commons/proper/daemon/trunk/src/native/windows/src/service.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/windows/src/service.c?rev=1138933&r1=1138932&r2=1138933&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/windows/src/service.c (original)
+++ commons/proper/daemon/trunk/src/native/windows/src/service.c Thu Jun 23 15:30:21 2011
@@ -88,7 +88,8 @@ apxCreateService(APXHANDLE hPool, DWORD
SC_HANDLE hManager;
if (!(hManager = OpenSCManager(NULL, NULL, dwOptions))) {
- apxLogWrite(APXLOG_MARK_SYSERR);
+ if (GetLastError() != ERROR_ACCESS_DENIED)
+ apxLogWrite(APXLOG_MARK_SYSERR);
return NULL;
}
hService = apxHandleCreate(hPool, 0,
@@ -134,7 +135,8 @@ apxServiceOpen(APXHANDLE hService, LPCWS
dwOptions);
if (IS_INVALID_HANDLE(lpService->hService)) {
- apxLogWrite(APXLOG_MARK_SYSERR);
+ if (GetLastError() != ERROR_ACCESS_DENIED)
+ apxLogWrite(APXLOG_MARK_SYSERR);
return FALSE;
}
lstrlcpyW(lpService->stServiceEntry.szServiceName, SIZ_RESLEN, szServiceName);