[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdenonbeta/applets/kim/kimd
From:       Malte Starostik <malte () kde ! org>
Date:       2003-11-23 22:06:41
[Download RAW message or body]

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 )
         {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic