Red Hat Bugzilla – Bug 199174
top returns with exit code 1 even if no error occurs
Last modified: 2007-11-30 17:11:38 EST
Description of problem:
top returns with exit code 1 even if there were no problems; it should return
exit code 0.
Version-Release number of selected component (if applicable):
procps-3.2.6-3.5 (goes back to FC4 releases as well, FC3 is fine)
Steps to Reproduce:
1.top -b -n 1 > /dev/null; echo $?
Provided URL of Debian bug report, including following patch:
--- top.c.orig 2006-03-30 18:11:43.000000000 +0200
+++ top.c 2006-03-30 18:13:18.000000000 +0200
@@ -408,7 +408,7 @@ static void end_pgm (int dont_care_sig)
static void end_pgm (int dont_care_sig)
- bye_bye(stdout, 1, NULL);
+ bye_bye(stdout, 0, NULL);
A slightly modified version (small line-number offset) suitable for use with FC5
updates, is attached.
Created attachment 132567 [details]
patch to fix top exit code returns
The patch has been added to FC6. I don't have feedback from upstream maintainer
(yet?), but I think you're right that it seems strange if the top return same
code for error as for standard end.