top: normal exit code should be 0

This commit is contained in:
albert
2007-05-27 23:56:49 +00:00
parent 94b2a2e910
commit 8e4bf3e115
2 changed files with 7 additions and 5 deletions

11
top.c
View File

@ -405,11 +405,12 @@ static void bye_bye (FILE *fp, int eno, const char *str)
* Normal end of execution.
* catches:
* SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGQUIT and SIGTERM */
static void end_pgm (int dont_care_sig) NORETURN;
static void end_pgm (int dont_care_sig)
static void end_pgm (int sig) NORETURN;
static void end_pgm (int sig)
{
(void)dont_care_sig;
bye_bye(stdout, 1, NULL);
if(sig)
sig |= 0x80; // for a proper process exit code
bye_bye(stdout, sig, NULL);
}
@ -653,7 +654,7 @@ static void show_special (int interact, const char *glob)
while ((lin_end = strchr(glob, '\n'))) {
/* create a local copy we can extend and otherwise abuse */
memcpy(lin, glob, (unsigned)(lin_end - glob));
memcpy(lin, glob, (unsigned)(lin_end - glob)); FIXME -- buffer overflow
/* zero terminate this part and prepare to parse substrings */
lin[lin_end - glob] = '\0';
room = Screen_cols;