]>
Commit | Line | Data |
---|---|---|
c35d504c ER |
1 | set FD_CLOEXEC on listening socket |
2 | ||
3 | Skype4Py uses os.execlp() to spawn skype if it is not yet started, this leaks | |
4 | our listening FD to skype process and can't get it back even if we ourself exit | |
5 | meanwhile. | |
6 | ||
7 | and we can't startup again: | |
8 | error: [Errno 98] Address already in use | |
9 | ||
10 | Signed-off-by: Elan Ruusamäe <glen@delfi.ee> | |
11 | Tested-by: Elan Ruusamäe <glen@delfi.ee> | |
12 | --- bitlbee-3.0.5/protocols/skype/skyped.py~ 2012-04-15 12:42:34.110550155 +0300 | |
13 | +++ bitlbee-3.0.5/protocols/skype/skyped.py 2012-04-15 13:50:51.089559368 +0300 | |
14 | @@ -31,6 +31,7 @@ | |
15 | import hashlib | |
16 | from ConfigParser import ConfigParser, NoOptionError | |
17 | from traceback import print_exception | |
18 | +from fcntl import fcntl, F_SETFD, FD_CLOEXEC | |
19 | import ssl | |
20 | ||
21 | __version__ = "0.1.1" | |
22 | @@ -184,8 +185,10 @@ | |
23 | else: | |
24 | sock = socket.socket() | |
25 | sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | |
26 | + fcntl(sock, F_SETFD, FD_CLOEXEC); | |
27 | sock.bind((host, port)) | |
28 | sock.listen(1) | |
29 | + | |
30 | if hasgobject: | |
31 | gobject.io_add_watch(sock, gobject.IO_IN, listener) | |
32 | else: |