Update KillFilter to handle 'deleted' exe's.

Updates KillFilter so that it handles the case where the executable
linked to by /proc/PID/exe is updated or deleted.

Fixes LP Bug #967931.

Change-Id: I368a01383bf62b64b7579d573b8b84640dec03ae
This commit is contained in:
Dan Prince 2012-03-28 22:00:11 -04:00
parent 998e57b296
commit b24c11b4c3

View File

@ -117,6 +117,9 @@ class KillFilter(CommandFilter):
return False
try:
command = os.readlink("/proc/%d/exe" % int(args[1]))
# NOTE(dprince): /proc/PID/exe may have ' (deleted)' on
# the end if an executable is updated or deleted
command = command.rstrip(" (deleted)")
if command not in self.args[1]:
# Affected executable not in accepted list
return False