mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-18 21:45:24 +00:00
Fix bug 1784
http://bugzilla.lyx.org/show_bug.cgi?id=1784 git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@26738 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
62c461d6a2
commit
6d2f3cb16e
@ -246,6 +246,12 @@ void LyXComm::read_ready()
|
||||
int const charbuf_size = 100;
|
||||
char charbuf[charbuf_size];
|
||||
|
||||
// As O_NONBLOCK is set, until no data is available for reading,
|
||||
// read() doesn't block but returns -1 and set errno to EAGAIN.
|
||||
// After a client that opened the pipe for writing, closes it
|
||||
// (and no other client is using the pipe), read() would always
|
||||
// return 0 and thus the connection has to be reset.
|
||||
|
||||
errno = 0;
|
||||
int status;
|
||||
// the single = is intended here.
|
||||
@ -268,12 +274,13 @@ void LyXComm::read_ready()
|
||||
clientcb(client, cmd);
|
||||
//\n or not \n?
|
||||
}
|
||||
}
|
||||
if (errno == EAGAIN) {
|
||||
errno = 0;
|
||||
return;
|
||||
}
|
||||
if (errno != 0) {
|
||||
} else {
|
||||
if (errno == EAGAIN) {
|
||||
// Nothing to read, continue
|
||||
errno = 0;
|
||||
return;
|
||||
}
|
||||
// An error occurred, better bailing out
|
||||
lyxerr << "LyXComm: " << strerror(errno) << endl;
|
||||
if (!read_buffer_.empty()) {
|
||||
lyxerr << "LyXComm: truncated command: "
|
||||
@ -284,8 +291,9 @@ void LyXComm::read_ready()
|
||||
}
|
||||
}
|
||||
|
||||
// The connection gets reset in errno != EAGAIN
|
||||
// Why does it need to be reset if errno == 0?
|
||||
// The connection gets reset when read() returns 0 (meaning that the
|
||||
// last client closed the pipe) or an error occurred, in which case
|
||||
// read() returns -1 and errno != EAGAIN.
|
||||
closeConnection();
|
||||
openConnection();
|
||||
errno = 0;
|
||||
|
@ -135,6 +135,9 @@ What's new
|
||||
|
||||
- Remove confusing warning about 'server socket' under MS Windows.
|
||||
|
||||
- Fix problem that the lyxpipe was incorrectly reset after dispatching
|
||||
certain functions (bug 1784).
|
||||
|
||||
|
||||
* DOCUMENTATION AND LOCALIZATION
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user