Fix small typo
This commit is contained in:
@ -25,7 +25,7 @@ struct Config
|
||||
bool ignoreClientMachine = false;
|
||||
};
|
||||
|
||||
const char *argp_program_version = "1.0";
|
||||
const char *argp_program_version = "1.0.1";
|
||||
const char *argp_program_bug_address = "<carl@uvos.xyz>";
|
||||
static char doc[] = "Deamon that stops programms via SIGSTOP when their X11 windows lose focus.";
|
||||
static char args_doc[] = "";
|
||||
@ -42,7 +42,7 @@ error_t parse_opt (int key, char *arg, struct argp_state *state)
|
||||
Config* config = reinterpret_cast<Config*>(state->input);
|
||||
switch (key)
|
||||
{
|
||||
case 'v':
|
||||
case 'i':
|
||||
config->ignoreClientMachine = true;
|
||||
break;
|
||||
default:
|
||||
|
2
debian/control
vendored
2
debian/control
vendored
@ -6,7 +6,7 @@ Build-Depends:
|
||||
debhelper,
|
||||
cmake,
|
||||
libx11-dev,
|
||||
Standards-Version: 1.0
|
||||
Standards-Version: 1.0.1
|
||||
|
||||
Package: sigstoped
|
||||
Architecture: any
|
||||
|
4
main.cpp
4
main.cpp
@ -141,7 +141,7 @@ int main(int argc, char* argv[])
|
||||
Config config;
|
||||
argp_parse(&argp, argc, argv, 0, 0, &config);
|
||||
|
||||
if(config->ignoreClientMachine)
|
||||
if(config.ignoreClientMachine)
|
||||
{
|
||||
std::cout<<"WARNING: Ignoring WM_CLIENT_MACHINE is dangerous and may cause sigstoped to stop random pids if remote windows are present"<<std::endl;
|
||||
XInstance::ignoreClientMachine = true;
|
||||
@ -150,7 +150,7 @@ int main(int argc, char* argv[])
|
||||
std::string confDir = getConfdir();
|
||||
if(confDir.size() == 0) return 1;
|
||||
|
||||
createPidFile(confDir+"pidfile");
|
||||
if(!createPidFile(confDir+"pidfile")) return 1;
|
||||
|
||||
std::vector<std::string> applicationNames = getApplicationlist(confDir+"blacklist");
|
||||
|
||||
|
23
process.cpp
23
process.cpp
@ -68,18 +68,21 @@ bool Process::getStoped()
|
||||
std::vector<std::string> Process::openStatus()
|
||||
{
|
||||
std::fstream statusFile;
|
||||
statusFile.open(std::string("/proc/") + std::to_string(pid_)+ "/status", std::fstream::in);
|
||||
std::vector<std::string> lines;
|
||||
if(statusFile.is_open())
|
||||
if(pid_ > 0)
|
||||
{
|
||||
std::string statusString((std::istreambuf_iterator<char>(statusFile)),
|
||||
std::istreambuf_iterator<char>());
|
||||
lines = split(statusString);
|
||||
statusFile.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout<<"cant open "<<"/proc/" + std::to_string(pid_)+ "/status"<<std::endl;
|
||||
statusFile.open(std::string("/proc/") + std::to_string(pid_)+ "/status", std::fstream::in);
|
||||
if(statusFile.is_open())
|
||||
{
|
||||
std::string statusString((std::istreambuf_iterator<char>(statusFile)),
|
||||
std::istreambuf_iterator<char>());
|
||||
lines = split(statusString);
|
||||
statusFile.close();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout<<"cant open "<<"/proc/" + std::to_string(pid_)+ "/status"<<std::endl;
|
||||
}
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
Reference in New Issue
Block a user