Commit 6827c280 authored by Guido van Rossum's avatar Guido van Rossum

Fix a problem in rotate_logs_handler(), caused by my changing the

signal meanings: rotate_logs_handler() was changing the SIGHUP handler
to rotate the logs!  zdaemon did not do anything wrong. :-)
Fixed by *removing* the signal() call inside the handler -- this is
not needed in modern Unixes.

Also changed setup_signals(): there was a typo in the name SIFXFSZ(!);
and made all the signal conditional on whether the signal module has
that particular signal (e.g. on Windows, a signal module exists, but
it only defines a few signals).
parent aeb99a80
......@@ -81,18 +81,14 @@ def setup_signals(storages):
except ImportError:
return
try:
xfsz = signal.SIFXFSZ
except AttributeError:
pass
else:
signal.signal(xfsz, signal.SIG_IGN)
signal.signal(signal.SIGTERM, lambda sig, frame: shutdown(storages))
signal.signal(signal.SIGHUP, lambda sig, frame: shutdown(storages, 0))
try:
if hasattr(signal, 'SIGXFSZ'):
signal.signal(signal.SIGXFSZ, signal.SIG_IGN)
if hasattr(signal, 'SIGTERM'):
signal.signal(signal.SIGTERM, lambda sig, frame: shutdown(storages))
if hasattr(signal, 'SIGHUP'):
signal.signal(signal.SIGHUP, lambda sig, frame: shutdown(storages, 0))
if hasattr(signal, 'SIGUSR2'):
signal.signal(signal.SIGUSR2, rotate_logs_handler)
except:
pass
def main(argv):
me = argv[0]
......@@ -316,9 +312,6 @@ def rotate_logs():
def rotate_logs_handler(signum, frame):
rotate_logs()
import signal
signal.signal(signal.SIGHUP, rotate_logs_handler)
def shutdown(storages, die=1):
LOG("ZEO/start.py", INFO, "Received signal")
import asyncore
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment