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

List:       kde-devel
Subject:    mmap problem
From:       Usarin Heininga <usarin () heininga ! nl>
Date:       2004-12-22 16:27:07
Message-ID: 200412221727.08217.usarin () heininga ! nl
[Download RAW message or body]

I found a bug in kdelibs/kdecore/kconfigbackend.cpp, the code looks like this
 
  map = ( const char* ) mmap(0, rFile.size(), PROT_READ, MAP_PRIVATE,
                                          rFile.handle(), 0);
   if (map)
   {
      s = (const char*) map;
      eof = s + rFile.size();

but it should be 

  map = ( const char* ) mmap(0, rFile.size(), PROT_READ, MAP_PRIVATE,
                                          rFile.handle(), 0);
   if (map != MAP_FAILED )
   {
      s = (const char*) map;
      eof = s + rFile.size();

Because mmap always returns something, but in case of error it wil return 
"MAP_FAILED".
This way config entries can be read from filesystems that don't support mmap, 
now it never gets to the normal reading part.

Regards Usarin Heininga
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

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