From kde-commits Sun Nov 23 22:06:41 2003 From: Malte Starostik Date: Sun, 23 Nov 2003 22:06:41 +0000 To: kde-commits Subject: kdenonbeta/applets/kim/kimd X-MARC-Message: https://marc.info/?l=kde-commits&m=106962523318336 CVS commit by malte: IIRC this did work before; apparently now FIONREAD always fails on /dev/isdninfo resulting in kimd eating all CPU as select() signals readability but the error on the ioctl() returns -1 with errno == EINVAL. M +12 -7 isdninfo.cpp 1.6 --- kdenonbeta/applets/kim/kimd/isdninfo.cpp #1.5:1.6 @@ -78,11 +78,16 @@ bool ISDNInfoDevice::doOpen( const std:: void ISDNInfoDevice::handleInput() { - int count; - if ( ioctl( handle(), FIONREAD, &count ) != 0 ) return; - char* buf = new char[ count + 1 ]; - read( handle(), buf, count ); - buf[ count ] = 0; + std::string info; + char buf[ 1024 ]; + int count = 0; + do + { + count = read( handle(), buf, sizeof( buf ) ); + if ( count == -1 ) return; // die? + info.append( buf, count ); + } + while ( count == sizeof( buf ) ); + StringList usage, phone, lines = split( '\n', buf ); - delete[] buf; for ( StringList::const_iterator it = lines.begin(); it != lines.end(); ++it ) {