Skip to content
Snippets Groups Projects
Commit cf28426b authored by Alexandros Frantzis's avatar Alexandros Frantzis
Browse files

winewayland.drv: Add helper to write all data to a file descriptor.


Add a function that ensures that all data is written to a file
descriptor, resuming in case of interruptions or partial writes.

Signed-off-by: default avatarAlexandros Frantzis <alexandros.frantzis@collabora.com>
parent 2daa2c80
No related branches found
No related tags found
No related merge requests found
......@@ -26,8 +26,35 @@
#include "waylanddrv.h"
#include "wine/debug.h"
#include "winternl.h"
#include <errno.h>
#include <unistd.h>
WINE_DEFAULT_DEBUG_CHANNEL(clipboard);
static void write_all(int fd, const void *buf, size_t count)
{
size_t nwritten = 0;
while (nwritten < count)
{
ssize_t ret = write(fd, (const char*)buf + nwritten, count - nwritten);
if (ret == -1 && errno != EINTR)
{
WARN("Failed to write all data, had %zu bytes, wrote %zu bytes (errno: %d)\n",
count, nwritten, errno);
break;
}
else if (ret > 0)
{
nwritten += ret;
}
}
}
/* Order is important. When selecting a mime-type for a clipboard format we
* will choose the first entry that matches the specified clipboard format. */
static struct wayland_data_device_format supported_formats[] =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment