/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos

  • Committer: Teddy Hogeborn
  • Date: 2008-09-05 18:19:52 UTC
  • mfrom: (24.1.91 mandos)
  • Revision ID: teddy@fukt.bsnet.se-20080905181952-qfuwtyvefanh9v3v
* mandos: Open the PID file before daemonizing, but write to it
          afterwards.

* plugin-runner.xml (SECURITY): Improved grammar.

Also merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
773
773
                                settings=server_settings,
774
774
                                clients=clients)
775
775
    pidfilename = "/var/run/mandos.pid"
 
776
    pidfile = None
776
777
    try:
777
778
        pidfile = open(pidfilename, "w")
778
779
    except IOError, error:
847
848
        # Close all input and output, do double fork, etc.
848
849
        daemon()
849
850
    
850
 
    try:
 
851
    if pidfile is not None:
851
852
        pid = os.getpid()
852
 
        pidfile.write(str(pid) + "\n")
853
 
        pidfile.close()
854
 
        del pidfile
855
 
    except IOError, err:
856
 
        logger.error(u"Could not write to file %r with PID %d",
857
 
                     pidfilename, pid)
858
 
    except NameError:
859
 
        # "pidfile" was never created
860
 
        pass
 
853
        try:
 
854
            pidfile.write(str(pid) + "\n")
 
855
            pidfile.close()
 
856
        except IOError, err:
 
857
            logger.error(u"Could not write %s file with PID %d",
 
858
                         pidfilename, os.getpid())
 
859
    del pidfile
861
860
    del pidfilename
862
861
    
863
862
    def cleanup():