[CalendarServer-changes] [1173]
CalendarServer/branches/users/tfitz/log-alot-128/lib-patches/Twisted
/twisted.scripts._twistd_unix.patch
source_changes at macosforge.org
source_changes at macosforge.org
Mon Feb 12 17:02:49 PST 2007
Revision: 1173
http://trac.macosforge.org/projects/calendarserver/changeset/1173
Author: tfitz at apple.com
Date: 2007-02-12 17:02:49 -0800 (Mon, 12 Feb 2007)
Log Message:
-----------
Paranoia.
Modified Paths:
--------------
CalendarServer/branches/users/tfitz/log-alot-128/lib-patches/Twisted/twisted.scripts._twistd_unix.patch
Modified: CalendarServer/branches/users/tfitz/log-alot-128/lib-patches/Twisted/twisted.scripts._twistd_unix.patch
===================================================================
--- CalendarServer/branches/users/tfitz/log-alot-128/lib-patches/Twisted/twisted.scripts._twistd_unix.patch 2007-02-13 00:53:40 UTC (rev 1172)
+++ CalendarServer/branches/users/tfitz/log-alot-128/lib-patches/Twisted/twisted.scripts._twistd_unix.patch 2007-02-13 01:02:49 UTC (rev 1173)
@@ -2,7 +2,7 @@
===================================================================
--- twisted/scripts/_twistd_unix.py (revision 19636)
+++ twisted/scripts/_twistd_unix.py (working copy)
-@@ -126,6 +126,11 @@
+@@ -126,14 +126,47 @@
sys.stdout.flush()
@@ -14,10 +14,7 @@
def daemonize():
# See http://www.erlenstar.demon.co.uk/unix/faq_toc.html#TOC16
if os.fork(): # launch child and...
-@@ -141,6 +146,19 @@
- except OSError, e:
- if e.errno != errno.EBADF:
- raise
+ os._exit(0) # kill off parent
+
+ fout = file(str(os.getpid()) + "_" + randstr() + ".log", "w")
+
@@ -31,6 +28,34 @@
+ import sys
+ sys.settrace(trace_verbose)
+
+ os.setsid()
+ if os.fork(): # launch child and...
+ os._exit(0) # kill off parent again.
++
++ fout = file(str(os.getpid()) + "_" + randstr() + ".log", "w")
++
++ def trace_verbose(frame, event, arg):
++ try:
++ print >>fout, frame.f_code.co_filename, frame.f_lineno
++ except Exception, e:
++ print >>fout, "!" + repr(e)
++ fout.flush()
++
++ import sys
++ sys.settrace(trace_verbose)
++
++
+ os.umask(077)
++
+ null=os.open('/dev/null', os.O_RDWR)
+ for i in range(3):
+ try:
+@@ -141,6 +174,8 @@
+ except OSError, e:
+ if e.errno != errno.EBADF:
+ raise
++
++
os.close(null)
def shedPrivileges(euid, uid, gid):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070212/15329549/attachment.html
More information about the calendarserver-changes
mailing list