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: Stefan Agner <stefan@agner.ch>
This commit is contained in:
committed by
Pekka Paalanen
parent
bd1e39a787
commit
10356a247b
@@ -95,6 +95,18 @@ struct launcher_weston_launch {
|
|||||||
int kb_mode, tty, drm_fd;
|
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
|
static int
|
||||||
launcher_weston_launch_open(struct weston_launcher *launcher_base,
|
launcher_weston_launch_open(struct weston_launcher *launcher_base,
|
||||||
const char *path, int flags)
|
const char *path, int flags)
|
||||||
@@ -118,9 +130,7 @@ launcher_weston_launch_open(struct weston_launcher *launcher_base,
|
|||||||
message->flags = flags;
|
message->flags = flags;
|
||||||
strcpy(message->path, path);
|
strcpy(message->path, path);
|
||||||
|
|
||||||
do {
|
launcher_weston_launch_send(launcher->fd, message, n);
|
||||||
len = send(launcher->fd, message, n, 0);
|
|
||||||
} while (len < 0 && errno == EINTR);
|
|
||||||
free(message);
|
free(message);
|
||||||
|
|
||||||
memset(&msg, 0, sizeof msg);
|
memset(&msg, 0, sizeof msg);
|
||||||
|
|||||||
Reference in New Issue
Block a user