Skip to content
Snippets Groups Projects
Commit 0354ec9b authored by Diego Giovane Pasqualin's avatar Diego Giovane Pasqualin
Browse files

Merge branch 'issue/28' into 'development'

Issue/28

Arrumar os padrões no Lint

See merge request !25
parents 6887c099 b71231e8
No related branches found
No related tags found
2 merge requests!51Merge development to master,!25Issue/28
Pipeline #
......@@ -204,7 +204,8 @@ static struct user_log * last_modified() {
/*
* Which file do we want to read?
*/
ufile = (char *)(WTMP_FILE);
char *auxar = WTMP_FILE;
ufile = auxar;
time(&lastdown);
/*
......@@ -481,11 +482,12 @@ int get_user_count() {
std::string wtmp_path = "/var/log/wtmp";
struct stat buffer;
if (stat(wtmp_path.c_str(), &buffer) != 0) { //file not exists
if (stat(wtmp_path.c_str(), &buffer) != 0) { // file not exists
ofstream wtmp_file;
wtmp_file.open(wtmp_path.c_str());
wtmp_file.close();
chown(wtmp_path.c_str(), getpwnam("root")->pw_uid, getgrnam("tty")->gr_gid);
chown(wtmp_path.c_str(), getpwnam("root")->pw_uid,
getgrnam("tty")->gr_gid);
chmod(wtmp_path.c_str(), 664);
}
......
......@@ -65,7 +65,8 @@ Json::Value get_inventory() {
inv["contact_date"] =
*/
if (inv["data"]["os_distro"].asString().find("Linux Comunicações") != std::string::npos) {
if (inv["data"]["os_distro"].asString().find("Linux Comunicações")
!= std::string::npos) {
try {
inv["data"]["machine_type"] = get_machine_type();
}
......
......@@ -24,9 +24,10 @@
string get_macaddr() {
PIP_ADAPTER_INFO AdapterInfo;
DWORD dwBufLen = sizeof(AdapterInfo);
char *mac_addr = (char*)malloc(17);
char *mac_addr = reinterpret_cast<char*>malloc(17);
AdapterInfo = (IP_ADAPTER_INFO *) malloc(sizeof(IP_ADAPTER_INFO));
AdapterInfo = (reinterpret_cast<char*>IP_ADAPTER_INFO *)
malloc(sizeof(IP_ADAPTER_INFO));
if (AdapterInfo == NULL) {
printf("Error allocating memory needed to call GetAdaptersinfo\n");
}
......@@ -35,7 +36,8 @@ string get_macaddr() {
// the dwBufLen variable
if (GetAdaptersInfo(AdapterInfo, &dwBufLen) == ERROR_BUFFER_OVERFLOW) {
AdapterInfo = (IP_ADAPTER_INFO *) malloc(dwBufLen);
AdapterInfo = (reinterpret_cast<char*>IP_ADAPTER_INFO *)
malloc(dwBufLen);
if (AdapterInfo == NULL) {
printf("Error allocating memory needed to call GetAdaptersinfo\n");
}
......@@ -46,7 +48,7 @@ string get_macaddr() {
// Contains pointer to current adapter info
PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo;
sprintf(mac_addr, "%02X:%02X:%02X:%02X:%02X:%02X",
snprintf(mac_addr, "%02X:%02X:%02X:%02X:%02X:%02X",
pAdapterInfo->Address[0], pAdapterInfo->Address[1],
pAdapterInfo->Address[2], pAdapterInfo->Address[3],
pAdapterInfo->Address[4], pAdapterInfo->Address[5]);
......
......@@ -30,7 +30,7 @@ std::string get_time() {
char buffer[20];
time(&rawtime);
timeinfo = localtime(&rawtime);
timeinfo = localtime_r(&rawtime, timeinfo);
// HH:MM:SS
strftime(buffer, 20, "%H:%M:%S", timeinfo);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment