https://gitlab.synchro.net/main/sbbs/-/commit/03fac2eefaccc428d7822bb5
Modified Files:
docs/v322_new.md src/sbbs3/smbutil.c src/xpdev/conwrap.c conwrap.h
Log Message:
xp_getch(): return 0 at end of input instead of an uninitialized byte
Fixes #1256
xp_getch() only checked read() for -1. At end of input read() returns 0,
so the function fell through and returned whatever happened to be in its uninitialized stack byte. smbutil's message reader took that garbage as a keypress, hit its default case and prompted again, forever, at full CPU: "smbutil r1 base < /dev/null" printed 433,382 prompts in three seconds.
Initialize the byte and treat read() <= 0 as the failure path, so end of
input returns 0 like a read error (the header now says so), and make
smbutil's reader stop on a 0 when its input is not a terminal. On a
console a 0 can be the first of an extended key's two reads, so there the reader keeps looping as before. The other callers (chksmb, sbbsecho) only
pause for a keypress and were never looping, so they need no change.
Verified with the same command on a scratch message base: one prompt,
"End of input", exit status 0, and the same through a pipe.
Co-Authored-By: Claude Fable 5.1 <
noreply@anthropic.com>
--- SBBSecho 3.38-Linux
* Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)