Убрал временный код

pull/3/head
Igor Belitskiy 2 years ago
parent 66c3eb5a41
commit 4e543a45d5

@ -21,9 +21,7 @@ void Quotas_sys::set_map_gui(map_str_str &map_gui) {
void Quotas_sys::check_partition_mount() {
string key = "";
// Todo:
// Заменить на чтение файла средствами с++
string response = obj_process_call.call_all_sections("cat /proc/mounts");
string response = Utils::file_read("/proc/mounts");
for (const auto& iter: (*map_device)) {
key = iter.first;
if (response.find(key) != string::npos) {
@ -172,21 +170,16 @@ bool Quotas_sys::on_quota_sw(string partition, int mode) {
bool Quotas_sys::off_quota(string partition, string quota_hw, string quota_sw) {
string cmd = "";
if (map_hw_or_sw.find(partition) != map_hw_or_sw.end()) {
if (map_hw_or_sw[partition] == "hw") {
if (this->wrapper_hw_sw(partition) == "hw") {
cmd = quota_hw + " " + partition;
obj_process_system.call(cmd, "");
return true;
}
else if (map_hw_or_sw[partition] == "sw") {
else if (this->wrapper_hw_sw(partition) == "sw") {
cmd = quota_sw + " " + partition;
obj_process_system.call(cmd, "");
return true;
}
else {
// TODO:
// Убрать после тестирования
throw "Опа цэ!";
return false;
}
obj_process_system.call(cmd, "");
}
return false;

@ -213,4 +213,18 @@ int synopsis_show(string str_link) {
}
return system(cmd.c_str());
}
string file_read(string filename) {
string line;
string buffer;
std::ifstream in(filename); // окрываем файл для чтения
if (in.is_open())
{
while (getline(in, line))
{
buffer += line;
}
}
return buffer;
}
}

@ -27,5 +27,6 @@ unsigned short read_uid_min_max(string filename, string search);
vector <string> pars_users();
string read_passwd(string username);
int synopsis_show(string str_link);
string file_read(string filename);
}
#endif
Loading…
Cancel
Save