fix bug so inadvertent errno does not break connection

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4814 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2002-07-31 04:40:31 +00:00
parent 1faca4e07e
commit f383b26ec6
2 changed files with 12 additions and 6 deletions

View 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)

View 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();