In the passt-repair protocol we just use a single byte for the command,
but we store it as an int at present. We construct a pointer to this int
into a pointer to an int8_t when sending the command in a way that's only
correct for little endian machines.
Signed-off-by: David Gibson
---
repair.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/repair.c b/repair.c
index 784b9943..f473e1f4 100644
--- a/repair.c
+++ b/repair.c
@@ -30,7 +30,7 @@
static int repair_fds[SCM_MAX_FD];
/* Pending command: flush pending file descriptors if it changes */
-static int repair_cmd;
+static int8_t repair_cmd;
/* Number of pending file descriptors set in @repair_fds */
static int repair_nfds;
@@ -145,7 +145,7 @@ void repair_handler(struct ctx *c, uint32_t events)
*/
int repair_flush(struct ctx *c)
{
- struct iovec iov = { &((int8_t){ repair_cmd }), sizeof(int8_t) };
+ struct iovec iov = { &repair_cmd, sizeof(repair_cmd) };
char buf[CMSG_SPACE(sizeof(int) * SCM_MAX_FD)]
__attribute__ ((aligned(__alignof__(struct cmsghdr))));
struct cmsghdr *cmsg;
--
2.48.1