From 415e308cf415975eefd82203aeac254860f22aa3 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Sat, 27 May 2006 13:39:11 +0000 Subject: [PATCH] =?UTF-8?q?=09*=20src/lyxsocket.C=20=09(LyXServerSocket::~?= =?UTF-8?q?LyXServerSocket):=20Don't=20try=20to=20unregister=20and=20=09cl?= =?UTF-8?q?ose=20fd=5F=20if=20the=20socket=20is=20disabled=20(avoids=20cra?= =?UTF-8?q?sh=20on=20win,=20from=20Peter=20=09K=C3=83=C5=92mmel)=20=09(LyX?= =?UTF-8?q?ServerSocket::~LyXServerSocket):=20Check=20the=20return=20value?= =?UTF-8?q?=20of=20close()=20=09(LyXDataSocket::~LyXDataSocket):=20ditto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13941 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/lyxsocket.C | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lyxsocket.C b/src/lyxsocket.C index e9d7918a92..5755bb6dcf 100644 --- a/src/lyxsocket.C +++ b/src/lyxsocket.C @@ -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."