For example, when pressing ^D on an empty command prompt of iprdbg(8), it will fall into a loop, flooding stdout (usually a terminal) and log file (/var/log/iprdbg):
# iprdbg
ATTENTION: This utility is for adapter developers only! Use at your own risk!
Use "quit" to exit the program.
IPRDB(572A)> Invalid command �. Use "help" for a list of valid commands
IPRDB(572A)> Invalid command �. Use "help" for a list of valid commands
IPRDB(572A)> Invalid command �. Use "help" for a list of valid commands
IPRDB(572A)> Invalid command �. Use "help" for a list of valid commands
IPRDB(572A)> Invalid command �. Use "help" for a list of valid commands
IPRDB(572A)> Invalid command �. Use "help" for a list of valid commands
...
This commit fixes 2 bugs:
ipr_fgets incorrectly stores the EOF mark ((int)-1) into the output buffer (pointed by buf), resulted in that garble character in above output;
The main loop in main didn't handle the stdin EOF condition, resulted an endless loop.
For example, when pressing ^D on an empty command prompt of iprdbg(8), it will fall into a loop, flooding stdout (usually a terminal) and log file (
/var/log/iprdbg
):This commit fixes 2 bugs:
ipr_fgets
incorrectly stores the EOF mark ((int)-1
) into the output buffer (pointed bybuf
), resulted in that garble character in above output;main
didn't handle the stdin EOF condition, resulted an endless loop.