44 lines
1.6 KiB
Diff
44 lines
1.6 KiB
Diff
From 771972c70736430e50dfa1519844da21de5a4054 Mon Sep 17 00:00:00 2001
|
|
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
|
Date: Fri, 20 Aug 2021 08:40:11 +0900
|
|
Subject: [PATCH] timesync: fix wrong type for receiving timestamp in
|
|
nanoseconds
|
|
|
|
(cherry picked from commit 6f96bdc58746b1698bf8b3430a6c638f8949daec)
|
|
|
|
Conflict:macro CMSG_BUFFER_TYPE is not defined, directly modify union
|
|
Reference:https://github.com/systemd/systemd-stable/commit/771972c70736430e50dfa1519844da21de5a4054
|
|
---
|
|
src/test/test-sizeof.c | 2 ++
|
|
src/timesync/timesyncd-manager.c | 2 +-
|
|
2 files changed, 3 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/test/test-sizeof.c b/src/test/test-sizeof.c
|
|
index 7fc16a6..0a8756c 100644
|
|
--- a/src/test/test-sizeof.c
|
|
+++ b/src/test/test-sizeof.c
|
|
@@ -75,5 +75,7 @@ int main(void) {
|
|
printf("big_enum2_pos → %zu\n", sizeof(big_enum2_pos));
|
|
printf("big_enum2_neg → %zu\n", sizeof(big_enum2_neg));
|
|
|
|
+ printf("timeval: %zu\n", sizeof(struct timeval));
|
|
+ printf("timespec: %zu\n", sizeof(struct timespec));
|
|
return 0;
|
|
}
|
|
diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c
|
|
index 3c3a7fe..848e87a 100644
|
|
--- a/src/timesync/timesyncd-manager.c
|
|
+++ b/src/timesync/timesyncd-manager.c
|
|
@@ -412,7 +412,7 @@ static int manager_receive_response(sd_event_source *source, int fd, uint32_t re
|
|
};
|
|
union {
|
|
struct cmsghdr cmsghdr;
|
|
- uint8_t buf[CMSG_SPACE(sizeof(struct timeval))];
|
|
+ uint8_t buf[CMSG_SPACE(sizeof(struct timespec))];
|
|
} control;
|
|
union sockaddr_union server_addr;
|
|
struct msghdr msghdr = {
|
|
--
|
|
2.27.0
|
|
|