mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 10:52:30 +00:00
1b81bb49b4
Official docs: Some headers from C library were deprecated in C++ and are no longer welcome in C++ codebases. Some have no effect in C++. For more details refer to the C++ 14 Standard [depr.c.headers] section. This check replaces C standard library headers with their C++ alternatives and removes redundant ones.
22 lines
591 B
C++
22 lines
591 B
C++
#include <cstring>
|
|
#include <string_view>
|
|
#include <Common/clearPasswordFromCommandLine.h>
|
|
|
|
using namespace std::literals;
|
|
|
|
void clearPasswordFromCommandLine(int argc, char ** argv)
|
|
{
|
|
for (int arg = 1; arg < argc; ++arg)
|
|
{
|
|
if (arg + 1 < argc && argv[arg] == "--password"sv)
|
|
{
|
|
++arg;
|
|
memset(argv[arg], 0, strlen(argv[arg]));
|
|
}
|
|
else if (0 == strncmp(argv[arg], "--password=", strlen("--password=")))
|
|
{
|
|
memset(argv[arg] + strlen("--password="), 0, strlen(argv[arg]) - strlen("--password="));
|
|
}
|
|
}
|
|
}
|