1 Star 0 Fork 98

Mingtai/systemd

forked from src-openEuler/systemd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-shared-format-table-allocate-buffer-of-sufficient-si.patch 1.65 KB
一键复制 编辑 原始数据 按行查看 历史
From e6407ca25852dadec355df2e6fdc92d1f189bceb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 5 Jul 2021 21:29:11 +0200
Subject: [PATCH] shared/format-table: allocate buffer of sufficient size
(cherry picked from commit 6dc57047ff0f1f9e98938ffb172dae06e6868b94)
Conflict:NA
Reference:https://github.com/systemd/systemd/commit/e6407ca25852dadec355df2e6fdc92d1f189bceb
---
src/shared/format-table.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/shared/format-table.c b/src/shared/format-table.c
index c4c3439541..4c4e4593d8 100644
--- a/src/shared/format-table.c
+++ b/src/shared/format-table.c
@@ -1409,7 +1409,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
_cleanup_free_ char *p = NULL;
char *ret;
- p = new(char, FORMAT_TIMESTAMP_MAX);
+ p = new(char, d->type == TABLE_TIMESTAMP_RELATIVE ? FORMAT_TIMESTAMP_RELATIVE_MAX : FORMAT_TIMESTAMP_MAX);
if (!p)
return NULL;
@@ -1418,7 +1418,7 @@ static const char *table_data_format(Table *t, TableData *d, bool avoid_uppercas
else if (d->type == TABLE_TIMESTAMP_UTC)
ret = format_timestamp_style(p, FORMAT_TIMESTAMP_MAX, d->timestamp, TIMESTAMP_UTC);
else
- ret = format_timestamp_relative(p, FORMAT_TIMESTAMP_MAX, d->timestamp);
+ ret = format_timestamp_relative(p, FORMAT_TIMESTAMP_RELATIVE_MAX, d->timestamp);
if (!ret)
return "n/a";
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yangmingtaip/systemd.git
git@gitee.com:yangmingtaip/systemd.git
yangmingtaip
systemd
systemd
master

搜索帮助