Do not let cron fail on errors around prctl

This commit is contained in:
Frédéric Péters 2011-06-27 09:57:45 +00:00
parent bd4d3b4519
commit 7853eaa1ca
1 changed files with 9 additions and 2 deletions

View File

@ -84,8 +84,15 @@ def spawn_cron(create_publisher):
pub = create_publisher()
# set process name, this only works on Linux, 15 == PR_SET_NAME
if dl:
libc = dl.open('/lib/libc.so.6')
libc.call('prctl', 15, os.path.basename(sys.argv[0]) + ' [cron]\0', 0, 0, 0)
try:
libc = dl.open('/lib/libc.so.6')
except dl.error:
pass
else:
try:
libc.call('prctl', 15, os.path.basename(sys.argv[0]) + ' [cron]\0', 0, 0, 0)
except ValueError: # missing symbol
pass
signal.signal(signal.SIGTERM, stop_cron_process)
cron(pub)
sys.exit(0)