]> granicus.if.org Git - icinga2/commitdiff
Fix incorrect format strings
authorGunnar Beutner <gunnar.beutner@icinga.com>
Wed, 13 Dec 2017 11:48:14 +0000 (12:48 +0100)
committerGunnar Beutner <gunnar.beutner@icinga.com>
Thu, 14 Dec 2017 07:50:09 +0000 (08:50 +0100)
icinga-app/icinga.cpp
plugins/check_ping.cpp

index f206708632f17dff58e89e2a7475a62d58304afd..acc8f42abd67afb8381b9a2e028517aa45a01129 100644 (file)
@@ -684,14 +684,15 @@ static int SetupService(bool install, int argc, char **argv)
                        return 1;
                }
 
-               printf("Service successfully installed for user '%s'\n", scmUser);
+               std::cout << "Service successfully installed for user '" << scmUser << "'\n";
 
-               std::ofstream fuser(Utility::GetIcingaDataPath() + "\\etc\\icinga2\\user", std::ios::out | std::ios::trunc);
+               String userFilePath = Utility::GetIcingaDataPath() + "\\etc\\icinga2\\user";
+
+               std::ofstream fuser(userFilePath.CStr(), std::ios::out | std::ios::trunc);
                if (fuser)
                        fuser << scmUser;
                else
-                       printf("Could not write user to %s\\etc\\icinga2\\user", Utility::GetIcingaDataPath());
-               fuser.close();
+                       std::cout << "Could not write user to " << userFilePath << "\n";
        }
 
        CloseServiceHandle(schService);
index 481253eb6b1a22087c5dda6b8fe657c6b49304d2..1cbdbe373168d396e3d8e82682564a4c25b848cc 100644 (file)
@@ -119,9 +119,9 @@ INT parseArguments(INT ac, WCHAR **av, po::variables_map& vm, printInfoStruct& p
                wprintf(
                        L"\nIt will take at least timeout times number of pings to run\n"
                        L"Then it will output a string looking something like this:\n\n"
-                       L"\tPING WARNING RTA: 72ms Packet loss: 20% | ping=72ms;40;80;71;77 pl=20%;20;50;0;100\n\n"
+                       L"\tPING WARNING RTA: 72ms Packet loss: 20%% | ping=72ms;40;80;71;77 pl=20%%;20;50;0;100\n\n"
                        L"\"PING\" being the type of the check, \"WARNING\" the returned status\n"
-                       L"and \"RTA: 72ms Packet loss: 20%\" the relevant information.\n"
+                       L"and \"RTA: 72ms Packet loss: 20%%\" the relevant information.\n"
                        L"The performance data is found behind the \"|\", in order:\n"
                        L"returned value, warning threshold, critical threshold, minimal value and,\n"
                        L"if applicable, the maximal value. \n\n"
@@ -145,8 +145,8 @@ INT parseArguments(INT ac, WCHAR **av, po::variables_map& vm, printInfoStruct& p
                        L"Does nothing if the plugin does not accept percentages, or only uses\n"
                        L"percentage thresholds. Ranges can be used with \"%%\", but both range values need\n"
                        L"to end with a percentage sign.\n\n"
-                       L"All of these options work with the critical threshold \"-c\" too."
-                       progName);
+                       L"All of these options work with the critical threshold \"-c\" too.",
+                       progName);
                std::cout << '\n';
                return 0;
        }