]> git.pld-linux.org Git - packages/PyMSNt.git/blobdiff - PyMSNt-remove-pid.patch
- bugfixes from gentoo
[packages/PyMSNt.git] / PyMSNt-remove-pid.patch
diff --git a/PyMSNt-remove-pid.patch b/PyMSNt-remove-pid.patch
new file mode 100644 (file)
index 0000000..fb85d04
--- /dev/null
@@ -0,0 +1,41 @@
+--- pymsn-t/src/main.py        2008-04-04 17:45:43.000000000 +0400
++++ pymsn-t/src/main.py        2008-08-05 17:44:17.000000000 +0400
+@@ -91,6 +91,7 @@
+ from twisted.words.xish.domish import Element
+ from twisted.words.protocols.jabber import component
+ from twisted.words.protocols.jabber.jid import internJID
++from twisted.python import log
+
+ from debug import LogEvent, INFO, WARN, ERROR
+
+@@ -352,13 +353,29 @@
+               pf = open(config.pid, "w")
+               pf.write("%s\n" % pid)
+               pf.close()
++
++      def removePID(self, pidfile):
++              # Remove a PID file
++              if not pidfile:
++                      return
++              try:
++                      os.unlink(pidfile)
++              except OSError, e:
++                      if e.errno == errno.EACCES or e.errno == errno.EPERM:
++                              log.msg("Warning: No permission to delete pid file")
++                      else:
++                              log.msg("Failed to unlink PID file:")
++                              log.deferr()
++              except:
++                      log.msg("Failed to unlink PID file:")
++                      log.deferr()
+
+       def shuttingDown(self):
+               self.transportSvc.removeMe()
+               # Keep the transport running for another 3 seconds
+               def cb(ignored=None):
+                       if config.pid:
+-                              twistd.removePID(config.pid)
++                              self.removePID(config.pid)
+               d = Deferred()
+               d.addCallback(cb)
+               reactor.callLater(3.0, d.callback, None)
This page took 0.045218 seconds and 4 git commands to generate.