]> git.lyx.org Git - lyx.git/blobdiff - src/lyxsocket.C
* remove various xforms relicts, in particular:
[lyx.git] / src / lyxsocket.C
index bade99cb65d34267409c7c9fadc1fd9ed6671067..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."
@@ -219,7 +225,7 @@ bool LyXDataSocket::connected() const
 bool LyXDataSocket::readln(string & line)
 {
        int const charbuf_size = 100;
-        char charbuf[charbuf_size]; // buffer for the ::read() system call
+       char charbuf[charbuf_size]; // buffer for the ::read() system call
        int count;
 
        // read and store characters in buffer