Fix Coverity Scan findings, missing return and bad strcpy()

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2018-03-22 10:31:50 +01:00
parent 0bfaf351aa
commit 9e9f8b03d8

View File

@ -134,6 +134,8 @@ main()
rl_callback_read_char();
}
}
return 0;
}
void
@ -168,7 +170,8 @@ change_prompt(void)
prompt = !prompt;
/* save away the current contents of the line */
strcpy(line_buf, rl_line_buffer);
strncpy(line_buf, rl_line_buffer, sizeof(line_buf));
line_buf[sizeof(line_buf) - 1] = 0;
/* install a new handler which will change the prompt and erase the current line */
rl_callback_handler_install(get_prompt(), process_line);
@ -179,7 +182,7 @@ change_prompt(void)
/* redraw the current line - this is an undocumented function. It invokes the
* redraw-current-line command.
*/
rl_refresh_line(0, 0);
return rl_refresh_line(0, 0);
}
char *