Fix timeout of setroubleshoot so that it dies after 10 seconds of non use

This commit is contained in:
Dan Walsh 2013-04-19 13:57:03 -04:00
parent 320d67bf77
commit c88b17ba3f
2 changed files with 28 additions and 11 deletions

View File

@ -1,9 +1,11 @@
diff -up setroubleshoot-3.2.3/src/setroubleshootd~ setroubleshoot-3.2.3/src/setroubleshootd
--- setroubleshoot-3.2.3/src/setroubleshootd~ 2012-07-10 08:59:53.000000000 -0400
+++ setroubleshoot-3.2.3/src/setroubleshootd 2013-04-19 09:09:20.659883409 -0400
@@ -38,12 +38,11 @@ def usage():
diff -up setroubleshoot-3.2.3/src/setroubleshootd.timeout setroubleshoot-3.2.3/src/setroubleshootd
--- setroubleshoot-3.2.3/src/setroubleshootd.timeout 2012-07-10 08:59:53.000000000 -0400
+++ setroubleshoot-3.2.3/src/setroubleshootd 2013-04-19 13:55:38.675270996 -0400
@@ -37,16 +37,16 @@ syslog.openlog(pkg_name)
def usage():
print '''
-f --nofork no fork
+-D --debug debug
-c --config section.option=value set a configuration value
--v --verbose log INFO level and higher messages to console
--V --debug log DEBUG level and higher messages to console
@ -14,16 +16,22 @@ diff -up setroubleshoot-3.2.3/src/setroubleshootd~ setroubleshoot-3.2.3/src/setr
+timeout = 10
try:
opts, args = getopt.getopt(sys.argv[1:], "fc:h", ["nofork","config=","help"])
@@ -59,6 +58,7 @@ for o, a in opts:
- opts, args = getopt.getopt(sys.argv[1:], "fc:h", ["nofork","config=","help"])
+ opts, args = getopt.getopt(sys.argv[1:], "dfc:h", ["debug", "nofork","config=","help"])
except getopt.GetoptError:
# print help information and exit:
usage()
@@ -60,6 +60,9 @@ for o, a in opts:
if o in ("-f", "--nofork"):
fork = False
+ timeout = 0
+ if o in ("-d", "--debug"):
+ timeout = 0
+
if o in ("-c", "--config"):
config_setting = a
@@ -73,9 +73,7 @@ import dbus.service
if not parse_config_setting(config_setting):
@@ -73,9 +76,7 @@ import dbus.service
import dbus
try:
@ -33,3 +41,12 @@ diff -up setroubleshoot-3.2.3/src/setroubleshootd~ setroubleshoot-3.2.3/src/setr
# do the UNIX double-fork magic, see Stevens' "Advanced
# Programming in the UNIX Environment" for details (ISBN 0201563177)
pid = os.fork()
@@ -95,6 +96,8 @@ try:
f.close()
from setroubleshoot.server import RunFaultServer
+ syslog.syslog(syslog.LOG_DEBUG, _("RunFaultServer(%d)") % timeout)
+
RunFaultServer(timeout)
except OSError, e:

View File

@ -1,7 +1,7 @@
Summary: Helps troubleshoot SELinux problems
Name: setroubleshoot
Version: 3.2.3
Release: 2%{?dist}
Release: 3%{?dist}
License: GPLv2+
Group: Applications/System
URL: https://fedorahosted.org/setroubleshoot
@ -184,7 +184,7 @@ rm -rf %{buildroot}
%{_datadir}/dbus-1/system-services/org.fedoraproject.SetroubleshootFixit.service
%changelog
* Fri Apr 19 2013 Dan Walsh <dwalsh@redhat.com> - 3.2.3-2
* Fri Apr 19 2013 Dan Walsh <dwalsh@redhat.com> - 3.2.3-3
- Fix timeout of setroubleshoot so that it dies after 10 seconds of non use
* Fri Feb 15 2013 Dan Walsh <dwalsh@redhat.com> - 3.2.3-1