]> git.lyx.org Git - features.git/commitdiff
* src/lyxsocket.C
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Sat, 27 May 2006 13:39:11 +0000 (13:39 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Sat, 27 May 2006 13:39:11 +0000 (13:39 +0000)
(LyXServerSocket::~LyXServerSocket): Don't try to unregister and
close fd_ if the socket is disabled (avoids crash on win, from Peter
KÃŒmmel)
(LyXServerSocket::~LyXServerSocket): Check the return value of close()
(LyXDataSocket::~LyXDataSocket): ditto

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13941 a592a061-630c-0410-9148-cb99ea01b6c8

src/lyxsocket.C

index e9d7918a92c088a692c04603d9365cd14cd4f61b..5755bb6dcf3271eda7432bef3a528671a3acfb1e 100644 (file)
@@ -74,8 +74,12 @@ LyXServerSocket::LyXServerSocket(LyXFunc * f, string const & addr)
 // Close the socket and remove the address of the filesystem.
 LyXServerSocket::~LyXServerSocket()
 {
-       lyx_gui::unregister_socket_callback(fd_);
-       ::close(fd_);
+       if (fd_ != -1) {
+               lyx_gui::unregister_socket_callback(fd_);
+               if (::close(fd_) != 0)
+                       lyxerr << "lyx: Server socket " << fd_
+                              << " IO error on closing: " << strerror(errno);
+       }
        lyx::support::unlink(address_);
        lyxerr[Debug::LYXSERVER] << "lyx: Server socket quitting" << endl;
 }
@@ -201,7 +205,9 @@ LyXDataSocket::LyXDataSocket(int fd)
 
 LyXDataSocket::~LyXDataSocket()
 {
-       ::close(fd_);
+       if (::close(fd_) != 0)
+               lyxerr << "lyx: Data socket " << fd_
+                      << " IO error on closing: " << strerror(errno);
 
        lyx_gui::unregister_socket_callback(fd_);
        lyxerr[Debug::LYXSERVER] << "lyx: Data socket " << fd_ << " quitting."