aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/skype/skyped.py
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@vmiklos.hu>2012-04-22 23:48:09 +0200
committerMiklos Vajna <vmiklos@vmiklos.hu>2012-04-22 23:48:09 +0200
commit9ce44dd377c6a07f6bed78dcbfe83b5b00e15b6d (patch)
tree2f04d82cedc271ddbef66d4af1311a57b8edc14d /protocols/skype/skyped.py
parente93fa057d26a4b06d17b619de541e3cba3006008 (diff)
skyped: set FD_CLOEXEC on listening socket
Skype4Py uses os.execlp() to spawn skype if it is not yet started, this leaks our listening FD to skype process and can't get it back even if we ourself exit meanwhile. and we can't startup again: error: [Errno 98] Address already in use Patch-by: Elan Ruusamäe <glen@delfi.ee>
Diffstat (limited to 'protocols/skype/skyped.py')
-rw-r--r--protocols/skype/skyped.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/protocols/skype/skyped.py b/protocols/skype/skyped.py
index 3b6499c1..07c08435 100644
--- a/protocols/skype/skyped.py
+++ b/protocols/skype/skyped.py
@@ -31,6 +31,7 @@ import Skype4Py
import hashlib
from ConfigParser import ConfigParser, NoOptionError
from traceback import print_exception
+from fcntl import fcntl, F_SETFD, FD_CLOEXEC
import ssl
__version__ = "0.1.1"
@@ -184,8 +185,10 @@ def server(host, port, skype = None):
else:
sock = socket.socket()
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+ fcntl(sock, F_SETFD, FD_CLOEXEC);
sock.bind((host, port))
sock.listen(1)
+
if hasgobject:
gobject.io_add_watch(sock, gobject.IO_IN, listener)
else: