summaryrefslogtreecommitdiff
path: root/connection.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@redhat.com>2008-12-09 10:47:36 -0500
committerKristian Høgsberg <krh@redhat.com>2008-12-09 10:48:52 -0500
commitfdea72a078f15740a86ea48ad2d479d29c68370a (patch)
treeb328fec207d4f76e8439908069f1b84029b17c46 /connection.c
parentdbd54640f4308e2f6f1c73788de026f1d80c3b0f (diff)
Handle interrupted system calls in connection code.
Diffstat (limited to 'connection.c')
-rw-r--r--connection.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/connection.c b/connection.c
index c6643a1..9d63f82 100644
--- a/connection.c
+++ b/connection.c
@@ -123,7 +123,9 @@ int wl_connection_data(struct wl_connection *connection, uint32_t mask)
iov[1].iov_len = b->tail;
count = 2;
}
- len = readv(connection->fd, iov, count);
+ do {
+ len = readv(connection->fd, iov, count);
+ } while (len < 0 && errno == EINTR);
if (len < 0) {
fprintf(stderr,
"read error from connection %p: %m (%d)\n",
@@ -166,7 +168,9 @@ int wl_connection_data(struct wl_connection *connection, uint32_t mask)
iov[1].iov_len = b->head;
count = 2;
}
- len = writev(connection->fd, iov, count);
+ do {
+ len = writev(connection->fd, iov, count);
+ } while (len < 0 && errno == EINTR);
if (len < 0) {
fprintf(stderr, "write error for connection %p: %m\n", connection);
return -1;