!34 fix file type chamges caused by top -b redirection

Merge pull request !34 from zhouwenpei/master
This commit is contained in:
openeuler-ci-bot 2022-02-08 07:14:23 +00:00 committed by Gitee
commit f08ee40adb
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 44 additions and 1 deletions

View File

@ -0,0 +1,39 @@
From 27e60e86e9f5b85520da001422176700fc9d824a Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@comcast.net>
Date: Mon, 21 Jun 2021 00:00:00 -0500
Subject: [PATCH] top: fix a fix for the 'bye_bye' function (merge #127)
In the merge request shown below, 1 too many bytes are
written to stdout thus including the terminating null.
As the cure, this commit just reduces the length by 1.
[ along the way, we will remove some unneeded braces ]
[ plus add some additional comments with attribution ]
Reference(s):
https://gitlab.com/procps-ng/procps/-/merge_requests/127
. original ported cchange
commit 6b8980a3b6279058d727377e914cfb6439d6f178
Signed-off-by: Jim Warner <james.warner@comcast.net>
---
top/top.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/top/top.c b/top/top.c
index b3e1bcf..9248c7a 100644
--- a/top/top.c
+++ b/top/top.c
@@ -572,7 +572,7 @@ static void bye_bye (const char *str) {
exit(EXIT_FAILURE);
}
if (Batch) {
- write(fileno(stdout), "\n", sizeof("\n"));
+ write(fileno(stdout), "\n", sizeof("\n") - 1);
}
exit(EXIT_SUCCESS);
} // end: bye_bye
--
1.8.3.1

View File

@ -1,6 +1,6 @@
Name: procps-ng Name: procps-ng
Version: 3.3.17 Version: 3.3.17
Release: 1 Release: 2
Summary: Utilities that provide system information. Summary: Utilities that provide system information.
License: GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ License: GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+
URL: https://sourceforge.net/projects/procps-ng/ URL: https://sourceforge.net/projects/procps-ng/
@ -13,6 +13,7 @@ Patch1: 0001-top-fix-two-potential-alternate-display-mode-abends.patch
Patch2: 0002-top-In-the-bye_bye-function-replace-fputs-with-the-w.patch Patch2: 0002-top-In-the-bye_bye-function-replace-fputs-with-the-w.patch
Patch3: 0003-add-options-M-and-N-for-top.patch Patch3: 0003-add-options-M-and-N-for-top.patch
Patch4: 0004-top-exit-with-error-when-pid-overflow.patch Patch4: 0004-top-exit-with-error-when-pid-overflow.patch
Patch5: 0005-fix-a-fix-for-the-bye_bye-function.patch
BuildRequires: ncurses-devel libtool autoconf automake gcc gettext-devel systemd-devel BuildRequires: ncurses-devel libtool autoconf automake gcc gettext-devel systemd-devel
@ -92,6 +93,9 @@ ln -s %{_bindir}/pidof %{buildroot}%{_sbindir}/pidof
%{_mandir}/man* %{_mandir}/man*
%changelog %changelog
* Sat Jan 29 2022 zhouwenpei <zhouwenpei1@h-partners.com> - 3.3.17-2
- fix file type chamges caused by top -b redirection
* Thu Dec 2 2021 zhouwenpei <zhouwenpei1@huawei.com> - 3.3.17-1 * Thu Dec 2 2021 zhouwenpei <zhouwenpei1@huawei.com> - 3.3.17-1
- update to 3.3.17 - update to 3.3.17