daemon: Minor code reorganization.

This commit is contained in:
Tom Goff 2016-01-29 18:21:49 -05:00
parent 0dcf2c05f0
commit 104d05a4be
2 changed files with 9 additions and 8 deletions

View file

@ -12,6 +12,11 @@ procedures.
'''
import subprocess, os, ast
import fcntl
def closeonexec(fd):
fdflags = fcntl.fcntl(fd, fcntl.F_GETFD)
fcntl.fcntl(fd, fcntl.F_SETFD, fdflags | fcntl.FD_CLOEXEC)
def checkexec(execlist):
for bin in execlist:
@ -265,6 +270,6 @@ def checkforkernelmodule(name):
'''
with open('/proc/modules', 'r') as f:
for line in f:
if line[:len(name)] == name:
return line
if line.startswith(name + ' '):
return line.rstrip()
return None