]> git.lyx.org Git - features.git/commitdiff
fix bug so inadvertent errno does not break connection
authorJohn Levon <levon@movementarian.org>
Wed, 31 Jul 2002 04:40:31 +0000 (04:40 +0000)
committerJohn Levon <levon@movementarian.org>
Wed, 31 Jul 2002 04:40:31 +0000 (04:40 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4814 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/lyxserver.C

index 1455f1133aac87d1da4c6be18ef4e6a4eba9182e..b3a12c5f00693afcce04882147b9291eb6bfeb59 100644 (file)
@@ -1,3 +1,8 @@
+2002-07-31  John Levon  <levon@movementarian.org>
+
+       * lyxserver.C: don't let incidental errors get
+         in the way (errno)
 2002-07-30  John Levon  <levon@movementarian.org>
 
        * lyxfunc.C: disable character dialog in ERT inset (partial fix)
index 9f64d8f9be005c9af5a405c00dec14e1371cea67..35d9829e6bc6016d73473c070302966598139ab5 100644 (file)
@@ -271,7 +271,9 @@ void LyXComm::read_ready()
        errno = 0;
        int status;
        // the single = is intended here.
-       while ((status = read(infd, charbuf, CMDBUFLEN-1))) {
+       while ((status = read(infd, charbuf, CMDBUFLEN - 1))) {
+               int rerrno = errno;
                if (status > 0) {
                        charbuf[status]= '\0'; // turn it into a c string
                        lsbuf += rtrim(charbuf, "\r");
@@ -289,14 +291,13 @@ void LyXComm::read_ready()
                                        //\n or not \n?
                        }
                }
-               if (errno == EAGAIN) {
+               if (rerrno == EAGAIN) {
                        errno = 0;
                        return;
                }
-               if (errno != 0) {
-                       lyxerr << "LyXComm: " << strerror(errno) << endl;
-                       if (!lsbuf.empty())
-                       {
+               if (rerrno != 0) {
+                       lyxerr << "LyXComm: " << strerror(rerrno) << endl;
+                       if (!lsbuf.empty()) {
                                lyxerr << "LyxComm: truncated command: "
                                       << lsbuf << endl;
                                lsbuf.erase();