Ticket #8540: daemonize.diff

File daemonize.diff, 617 bytes (added by paulegan, 7 years ago)

Patch for become_daemon to close all open files

  • django/utils/daemonize.py

     
    2424            sys.stderr.write("fork #2 failed: (%d) %s\n" % (e.errno, e.strerror))
    2525            os._exit(1)
    2626
     27        # Close all open files:
     28        for fd in xrange(0, os.sysconf('SC_OPEN_MAX')):
     29           try:
     30              os.close(fd)
     31           except OSError:
     32              pass
     33
    2734        si = open('/dev/null', 'r')
    2835        so = open(out_log, 'a+', 0)
    2936        se = open(err_log, 'a+', 0)
Back to Top