[Box Backup-dev] Exception thrown in bbackupquery when reading
form stdin
Chris Wilson
boxbackup-dev@fluffy.co.uk
Thu, 23 Feb 2006 20:54:47 +0000 (GMT)
Hi Mark,
> When I run bbackupquery everything goes well (logging in etc) up until the
> point that bbackupquery wants to read a commando from stdin.
[...]
> The problem is that the code _fileno(stdin) returns 0 and because of that,
> ::read(...) doesn't read anything.
>
> FdGetLine.cpp from line no 123:
> #ifdef WIN32
> int bytes;
>
> if (mFileHandle == _fileno(stdin)) <<<<<<<<<<<<< THIS RETURNS 0
> {
> bytes = console_read(mBuffer, sizeof(mBuffer));
> }
> else
> {
> bytes = ::read(mFileHandle, mBuffer,
> sizeof(mBuffer));
> }
> #else // !WIN32
> int bytes = ::read(mFileHandle, mBuffer, sizeof(mBuffer));
> #endif // WIN32
> // Error?
> if(bytes == -1)
> {
> THROW_EXCEPTION(CommonException, OSFileError)
> }
This code is there for a reason: standard read() cannot read unicode
characters on the input (returns zero), so it would be impossible to enter
a unicode filename in unicode mode without this code.
I would expect _fileno(stdin) to return zero, and mFileHandle to be zero
as well, so that we call console_read, which should work.
Could you look into why console_read is not working on your platform?
Thanks!
Cheers, Chris.
--
_ ___ __ _
/ __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK |
/ (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer |
\ _/_/_/_//_/___/ | We are GNU-free your mind-and your software |