summaryrefslogtreecommitdiffstats
path: root/tsak
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-04-18 14:23:17 -0500
committerSlávek Banko <slavek.banko@axis.cz>2012-06-03 03:27:06 +0200
commit8cbe82fbc11b1fabeed25107d5f768bd5c53e754 (patch)
treefa7fd2afaf6b50ceae325d83aca82014f89aa00d /tsak
parente97b5b2963635d0e7f6be99dc064087e07f4503f (diff)
downloadtdebase-8cbe82fbc11b1fabeed25107d5f768bd5c53e754.tar.gz
tdebase-8cbe82fbc11b1fabeed25107d5f768bd5c53e754.zip
Cleanup tsak FIFOs if unable to initialize and enter running state
(cherry picked from commit 632eda3b6c6d9aa903e31d3533e8bcb631868d0b)
Diffstat (limited to 'tsak')
-rw-r--r--tsak/main.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/tsak/main.cpp b/tsak/main.cpp
index 24a71666d..ddd8cef88 100644
--- a/tsak/main.cpp
+++ b/tsak/main.cpp
@@ -330,14 +330,20 @@ class PipeHandler
public:
PipeHandler();
~PipeHandler();
+
+ bool active;
};
PipeHandler::PipeHandler()
{
+ active = false;
}
PipeHandler::~PipeHandler()
{
+ if (active) {
+ tearDownPipe();
+ }
tearDownLockingPipe();
}
@@ -388,6 +394,8 @@ int main (int argc, char *argv[])
}
while (1) {
+ controlpipe.active = true;
+
if ((getuid ()) != 0) {
printf ("You are not root! This WILL NOT WORK!\nDO NOT attempt to bypass security restrictions, e.g. by changing keyboard permissions or owner, if you want the SAK system to remain secure...\n");
return 5;
@@ -405,7 +413,9 @@ int main (int argc, char *argv[])
sleep(1);
else {
int i=fork();
- if (i<0) return 12; // fork failed
+ if (i<0) {
+ return 12; // fork failed
+ }
if (i>0) {
return 4;
}
@@ -545,9 +555,12 @@ int main (int argc, char *argv[])
// fork udev monitor process
int i=fork();
- if (i<0) return 10; // fork failed
+ if (i<0) {
+ return 10; // fork failed
+ }
if (i>0) {
// Terminate parent
+ controlpipe.active = false;
return 0;
}