1 Star 0 Fork 25

yuq/procps-ng

forked from src-openEuler/procps-ng 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-uptime-fix-output-on-60-seconds.patch 1.04 KB
一键复制 编辑 原始数据 按行查看 历史
yueryoufeng 提交于 2024-04-23 15:58 . uptime: fix output on 60 seconds
From bfb0eadc38e789737dec7f14dd7a7ac00f5f0761 Mon Sep 17 00:00:00 2001
From: Robert Malz <[email protected]>
Date: Thu, 21 Sep 2023 16:45:49 +1000
Subject: [PATCH] uptime: fix output on 60 seconds
When procps_uptime will return 60 seconds uptime -p will not
provide any output except "up". To stay consistent with other
time units the expected output is "up 0 minutes".
References:
#302
Signed-off-by: Craig Small <[email protected]>
---
library/uptime.c | 2 +-
1 files changed, 1 insertions(+), 1 deletion(-)
diff --git a/library/uptime.c b/library/uptime.c
index b41538f5..5faeefca 100644
--- a/library/uptime.c
+++ b/library/uptime.c
@@ -258,7 +258,7 @@ PROCPS_EXPORT char *procps_uptime_sprint_short(void)
comma += 1;
}
- if (upminutes || (!upminutes && uptime_secs < 60)) {
+ if (upminutes || (!upminutes && uptime_secs <= 60)) {
pos += sprintf(shortbuf + pos, "%s%d %s",
comma > 0 ? ", " : "", upminutes,
upminutes != 1 ? "minutes" : "minute");
--
GitLab
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chinyu0704/procps-ng.git
[email protected]:chinyu0704/procps-ng.git
chinyu0704
procps-ng
procps-ng
master

搜索帮助