Commit 10356a24 authored by Stefan Agner's avatar Stefan Agner Committed by Pekka Paalanen

launcher-weston-launch: move send loop into separate function

Create a separate function handling the send loop. This allows to reuse
the same code later on.
Signed-off-by: default avatarStefan Agner <stefan@agner.ch>
parent bd1e39a7
......@@ -95,6 +95,18 @@ struct launcher_weston_launch {
int kb_mode, tty, drm_fd;
};
static ssize_t
launcher_weston_launch_send(int sockfd, void *buf, size_t buflen)
{
ssize_t len;
do {
len = send(sockfd, buf, buflen, 0);
} while (len < 0 && errno == EINTR);
return len;
}
static int
launcher_weston_launch_open(struct weston_launcher *launcher_base,
const char *path, int flags)
......@@ -118,9 +130,7 @@ launcher_weston_launch_open(struct weston_launcher *launcher_base,
message->flags = flags;
strcpy(message->path, path);
do {
len = send(launcher->fd, message, n, 0);
} while (len < 0 && errno == EINTR);
launcher_weston_launch_send(launcher->fd, message, n);
free(message);
memset(&msg, 0, sizeof msg);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment