mirror of
https://github.com/linux-can/can-utils.git
synced 2026-08-05 06:20:00 +02:00
cangen: do_send_one(): use sendmsg() instead of write()
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
@@ -200,11 +200,19 @@ static void sigterm(int signo)
|
||||
|
||||
static int do_send_one(int fd, void *buf, size_t len, int timeout)
|
||||
{
|
||||
struct iovec iov = {
|
||||
.iov_base = buf,
|
||||
.iov_len = len,
|
||||
};
|
||||
struct msghdr msg = {
|
||||
.msg_iov = &iov,
|
||||
.msg_iovlen = 1,
|
||||
};
|
||||
ssize_t nbytes;
|
||||
int ret;
|
||||
|
||||
resend:
|
||||
nbytes = write(fd, buf, len);
|
||||
nbytes = sendmsg(fd, &msg, 0);
|
||||
if (nbytes < 0) {
|
||||
ret = -errno;
|
||||
if (ret != -ENOBUFS) {
|
||||
|
||||
Reference in New Issue
Block a user