@@ -258,7 +258,7 @@ static int Main(void)
258
258
|| command->GetImpersonationLevel () == ImpersonationLevel::ImpersonateRoot) {
259
259
TCHAR szPath[MAX_PATH];
260
260
261
- if (GetModuleFileName (NULL , szPath, ARRAYSIZE (szPath))) {
261
+ if (GetModuleFileName (nullptr , szPath, ARRAYSIZE (szPath))) {
262
262
SHELLEXECUTEINFO sei = { sizeof (sei) };
263
263
sei.lpVerb = _T (" runas" );
264
264
sei.lpFile = " cmd.exe" ;
@@ -434,7 +434,7 @@ static int Main(void)
434
434
435
435
if (!command || vm.count (" help" )) {
436
436
if (!command)
437
- CLICommand::ShowCommands (argc, argv, NULL );
437
+ CLICommand::ShowCommands (argc, argv, nullptr );
438
438
439
439
std::cout << visibleDesc << std::endl
440
440
<< " Report bugs at <https://github.com/Icinga/icinga2>" << std::endl
@@ -477,7 +477,7 @@ static int Main(void)
477
477
}
478
478
479
479
if (getgid () != gr->gr_gid ) {
480
- if (!vm.count (" reload-internal" ) && setgroups (0 , NULL ) < 0 ) {
480
+ if (!vm.count (" reload-internal" ) && setgroups (0 , nullptr ) < 0 ) {
481
481
Log (LogCritical, " cli" )
482
482
<< " setgroups() failed with error code " << errno << " , \" " << Utility::FormatErrorNumber (errno) << " \" " ;
483
483
Log (LogCritical, " cli" )
@@ -567,19 +567,16 @@ static int Main(void)
567
567
#ifdef _WIN32
568
568
static int SetupService (bool install, int argc, char **argv)
569
569
{
570
- SC_HANDLE schSCManager = OpenSCManager (
571
- NULL ,
572
- NULL ,
573
- SC_MANAGER_ALL_ACCESS);
570
+ SC_HANDLE schSCManager = OpenSCManager (nullptr , nullptr , SC_MANAGER_ALL_ACCESS);
574
571
575
- if (NULL == schSCManager) {
572
+ if (! schSCManager) {
576
573
printf (" OpenSCManager failed (%d)\n " , GetLastError ());
577
574
return 1 ;
578
575
}
579
576
580
577
TCHAR szPath[MAX_PATH];
581
578
582
- if (!GetModuleFileName (NULL , szPath, MAX_PATH)) {
579
+ if (!GetModuleFileName (nullptr , szPath, MAX_PATH)) {
583
580
printf (" Cannot install service (%d)\n " , GetLastError ());
584
581
return 1 ;
585
582
}
@@ -604,7 +601,7 @@ static int SetupService(bool install, int argc, char **argv)
604
601
605
602
SC_HANDLE schService = OpenService (schSCManager, " icinga2" , SERVICE_ALL_ACCESS);
606
603
607
- if (schService != NULL ) {
604
+ if (schService) {
608
605
SERVICE_STATUS status;
609
606
ControlService (schService, SERVICE_CONTROL_STOP, &status);
610
607
@@ -634,13 +631,13 @@ static int SetupService(bool install, int argc, char **argv)
634
631
SERVICE_DEMAND_START,
635
632
SERVICE_ERROR_NORMAL,
636
633
szArgs.CStr (),
637
- NULL ,
638
- NULL ,
639
- NULL ,
634
+ nullptr ,
635
+ nullptr ,
636
+ nullptr ,
640
637
scmUser.c_str (),
641
- NULL );
638
+ nullptr );
642
639
643
- if (schService == NULL ) {
640
+ if (! schService) {
644
641
printf (" CreateService failed (%d)\n " , GetLastError ());
645
642
CloseServiceHandle (schSCManager);
646
643
return 1 ;
@@ -662,7 +659,7 @@ static int SetupService(bool install, int argc, char **argv)
662
659
printf (" Service uninstalled successfully\n " );
663
660
} else {
664
661
if (!ChangeServiceConfig (schService, SERVICE_NO_CHANGE, SERVICE_AUTO_START,
665
- SERVICE_ERROR_NORMAL, szArgs.CStr (), NULL , NULL , NULL , scmUser.c_str (), NULL , NULL )) {
662
+ SERVICE_ERROR_NORMAL, szArgs.CStr (), nullptr , nullptr , nullptr , scmUser.c_str (), nullptr , nullptr )) {
666
663
printf (" ChangeServiceConfig failed (%d)\n " , GetLastError ());
667
664
CloseServiceHandle (schService);
668
665
CloseServiceHandle (schSCManager);
@@ -677,7 +674,7 @@ static int SetupService(bool install, int argc, char **argv)
677
674
return 1 ;
678
675
}
679
676
680
- if (!StartService (schService, 0 , NULL )) {
677
+ if (!StartService (schService, 0 , nullptr )) {
681
678
printf (" StartService failed (%d)\n " , GetLastError ());
682
679
CloseServiceHandle (schService);
683
680
CloseServiceHandle (schSCManager);
@@ -743,7 +740,7 @@ static VOID WINAPI ServiceMain(DWORD argc, LPSTR *argv)
743
740
l_SvcStatus.dwServiceSpecificExitCode = 0 ;
744
741
745
742
ReportSvcStatus (SERVICE_RUNNING, NO_ERROR, 0 );
746
- l_Job = CreateJobObject (NULL , NULL );
743
+ l_Job = CreateJobObject (nullptr , nullptr );
747
744
748
745
for (;;) {
749
746
LPSTR arg = argv[0 ];
@@ -765,7 +762,7 @@ static VOID WINAPI ServiceMain(DWORD argc, LPSTR *argv)
765
762
766
763
char *uargs = strdup (args.CStr ());
767
764
768
- BOOL res = CreateProcess (NULL , uargs, NULL , NULL , FALSE , 0 , NULL , NULL , &si, &pi );
765
+ BOOL res = CreateProcess (nullptr , uargs, nullptr , nullptr , FALSE , 0 , nullptr , nullptr , &si, &pi );
769
766
770
767
free (uargs);
771
768
@@ -847,7 +844,7 @@ int main(int argc, char **argv)
847
844
if (argc > 1 && strcmp (argv[1 ], " --scm" ) == 0 ) {
848
845
SERVICE_TABLE_ENTRY dispatchTable[] = {
849
846
{ " icinga2" , ServiceMain },
850
- { NULL , NULL }
847
+ { nullptr , nullptr }
851
848
};
852
849
853
850
StartServiceCtrlDispatcher (dispatchTable);
0 commit comments