加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-timesync-fix-wrong-type-for-receiving-timestamp-in-n.patch 1.65 KB
一键复制 编辑 原始数据 按行查看 历史
From dac54d1aa759255144d9937361289bde57d64118 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
Fixes #20482.
(cherry picked from commit 6f96bdc58746b1698bf8b3430a6c638f8949daec)
Conflict:NA
Reference:https://github.com/systemd/systemd/commit/dac54d1aa759255144d9937361289bde57d64118
---
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 3c9dc180fa..e36bee4e8f 100644
--- a/src/test/test-sizeof.c
+++ b/src/test/test-sizeof.c
@@ -89,5 +89,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 cb5d42b1d3..9d874cfc8a 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
.iov_base = &ntpmsg,
.iov_len = sizeof(ntpmsg),
};
- CMSG_BUFFER_TYPE(CMSG_SPACE(sizeof(struct timeval))) control;
+ CMSG_BUFFER_TYPE(CMSG_SPACE(sizeof(struct timespec))) control;
union sockaddr_union server_addr;
struct msghdr msghdr = {
.msg_iov = &iov,
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化