mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-04 13:55:40 +08:00
Retry blocking writes.
This commit is contained in:
@@ -34,6 +34,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <errno.h>
|
||||||
#include "navdata.h"
|
#include "navdata.h"
|
||||||
|
|
||||||
#define NAVDATA_PACKET_SIZE 60
|
#define NAVDATA_PACKET_SIZE 60
|
||||||
@@ -61,6 +62,8 @@ static void navdata_write(const uint8_t *buf, size_t count)
|
|||||||
ssize_t n = write(nav_fd, buf + written, count - written);
|
ssize_t n = write(nav_fd, buf + written, count - written);
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
{
|
{
|
||||||
|
if (errno == EAGAIN || errno == EWOULDBLOCK)
|
||||||
|
continue;
|
||||||
perror("navdata_write: Write failed");
|
perror("navdata_write: Write failed");
|
||||||
// FIXME: what's sensible to do at this point?
|
// FIXME: what's sensible to do at this point?
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user