mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
[lvmetad] Continue reading/writing on EINTR
This commit is contained in:
parent
55c9286dea
commit
3843f54974
@ -56,9 +56,9 @@ int read_buffer(int fd, char **buffer) {
|
|||||||
errno = ECONNRESET;
|
errno = ECONNRESET;
|
||||||
goto fail; /* we should never encounter EOF here */
|
goto fail; /* we should never encounter EOF here */
|
||||||
}
|
}
|
||||||
if (result < 0 && errno != EAGAIN && errno != EWOULDBLOCK)
|
if (result < 0 && errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR)
|
||||||
goto fail;
|
goto fail;
|
||||||
/* TODO call select here if we encountered EAGAIN/EWOULDBLOCK */
|
/* TODO call select here if we encountered EAGAIN/EWOULDBLOCK/EINTR */
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
fail:
|
fail:
|
||||||
@ -71,7 +71,7 @@ fail:
|
|||||||
* Write a buffer to a filedescriptor. Keep trying. Blocks (even on
|
* Write a buffer to a filedescriptor. Keep trying. Blocks (even on
|
||||||
* SOCK_NONBLOCK) until all of the write went through.
|
* SOCK_NONBLOCK) until all of the write went through.
|
||||||
*
|
*
|
||||||
* TODO use select on EWOULDBLOCK/EAGAIN to avoid useless spinning
|
* TODO use select on EWOULDBLOCK/EAGAIN/EINTR to avoid useless spinning
|
||||||
*/
|
*/
|
||||||
int write_buffer(int fd, const char *buffer, int length) {
|
int write_buffer(int fd, const char *buffer, int length) {
|
||||||
static const char terminate[] = "\n##\n";
|
static const char terminate[] = "\n##\n";
|
||||||
@ -82,7 +82,7 @@ write:
|
|||||||
int result = write(fd, buffer + written, length - written);
|
int result = write(fd, buffer + written, length - written);
|
||||||
if (result > 0)
|
if (result > 0)
|
||||||
written += result;
|
written += result;
|
||||||
if (result < 0 && errno != EWOULDBLOCK && errno != EAGAIN)
|
if (result < 0 && errno != EWOULDBLOCK && errno != EAGAIN && errno != EINTR)
|
||||||
return 0; /* too bad */
|
return 0; /* too bad */
|
||||||
if (written == length) {
|
if (written == length) {
|
||||||
if (done)
|
if (done)
|
||||||
|
Loading…
Reference in New Issue
Block a user