[BusyBox] correct_password() /dev/tty

Vladimir N. Oleynik dzo at simtreas.ru
Wed Sep 15 07:42:29 UTC 2004


Glenn,

>>libbb/correct_password.c have line:
>>fputs ( "cannot open /dev/tty\n", stderr );
>>but bb_askpass() don`t open /dev/tty and use stdin
>>and return NULL if EOF or error of read(2).
>>As the algorithm has changed, I think, this line only misleads about
>>a problem and must removed.

> Perhaps errno should be preserved in bb_askpass, then correct_password
> could return a proper error message if read fails.
> Or, we could just not report any message, just retruning the 0 for error
> and let the calling function handle it.
> What do you think ?

bb_askpass() return NULL if read(2) return <= 0.
Its can be
1) EOF (Crtl-D)
2) timeout
3) problem with stdin.
1 and 2 point its a indicator "don`t know password"
or link problem (can`t distinguish).
3 point ... may be call perror, but not "cannot open /dev/tty" ;-)
For busybox I think special error a indicator do not require.

But for pedantically, require open /dev/tty and do not use stdin.


--w
vodz



More information about the busybox mailing list