change a lot, stable now

This commit is contained in:
fancy
2020-04-24 00:47:25 +08:00
parent 0aa9dd2f45
commit 6ed1be3c8a
8 changed files with 121 additions and 76 deletions

View File

@@ -22,10 +22,11 @@ bool exist(string path) {
bool validate(string pid, string cgroup) {
bool pid_v = regex_match(pid, regex("^[0-9]+$"));
bool cg_v = regex_match(cgroup, regex("^\\/[a-zA-Z0-9\\-_./@]+$"));
bool cg_v = regex_match(cgroup, regex("^\\/[a-zA-Z0-9\\-_./@]*$"));
if (pid_v && cg_v)
return true;
// cout<<pid_v<<" "<<cg_v<<endl;
puts("paramater validate error\n");
print_usage();
exit(EXIT_FAILURE);
}
@@ -39,6 +40,7 @@ int main(int argc, char *argv[]) {
}
if (argc != 3) {
puts("only need 2 paramaters\n");
print_usage();
exit(EXIT_FAILURE);
}