代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/systemd 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 6a8b886fef4ad101108126cab2125a90f7aa6441 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Wed, 11 Aug 2021 00:12:40 +0900
Subject: [PATCH] hostname: fix off-by-one issue in gethostname()
gethostname() returns null-terminated hostname.
Fixes #20309 and #20417.
(cherry picked from commit ccdf235464297c2ca4c1dea8733a6bad423084d5)
Conflict:NA
Reference:https://github.com/systemd/systemd/commit/6a8b886fef4ad101108126cab2125a90f7aa6441
---
src/shared/hostname-setup.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/shared/hostname-setup.c b/src/shared/hostname-setup.c
index 511aa7d031..742174d6c8 100644
--- a/src/shared/hostname-setup.c
+++ b/src/shared/hostname-setup.c
@@ -20,11 +20,11 @@
#include "util.h"
static int sethostname_idempotent_full(const char *s, bool really) {
- char buf[HOST_NAME_MAX + 1] = {};
+ char buf[HOST_NAME_MAX + 1];
assert(s);
- if (gethostname(buf, sizeof(buf) - 1) < 0)
+ if (gethostname(buf, sizeof(buf)) < 0)
return -errno;
if (streq(buf, s))
@@ -42,11 +42,11 @@ int sethostname_idempotent(const char *s) {
}
bool get_hostname_filtered(char ret[static HOST_NAME_MAX + 1]) {
- char buf[HOST_NAME_MAX + 1] = {};
+ char buf[HOST_NAME_MAX + 1];
/* Returns true if we got a good hostname, false otherwise. */
- if (gethostname(buf, sizeof(buf) - 1) < 0)
+ if (gethostname(buf, sizeof(buf)) < 0)
return false; /* This can realistically only fail with ENAMETOOLONG.
* Let's treat that case the same as an invalid hostname. */
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。