CheckAccessDeleted: Avoid reporting false positive due to insufficient permission.
authorMichael Andres <ma@suse.de>
Mon, 2 Nov 2009 15:37:42 +0000 (16:37 +0100)
committerMichael Andres <ma@suse.de>
Mon, 2 Nov 2009 15:54:56 +0000 (16:54 +0100)
zypp/misc/CheckAccessDeleted.cc

index 2d148b0..baeafe3 100644 (file)
@@ -92,16 +92,15 @@ namespace zypp
     }
 
     /** Add line to cache if it refers to a deleted executable or library file:
-     * - Either the link count \c(k) os \c 0, or no link cout is present.
+     * - Either the link count \c(k) is \c 0, or no link cout is present.
      * - The type \c (t) is set to \c REG or \c DEL
      * - The filedescriptor \c (f) is set to \c txt, \c mem or \c DEL
     */
     inline void addCacheIf( CheckAccessDeleted::ProcInfo & cache_r, const std::string & line_r )
     {
-      const char * k = ".";
-      const char * f = ".";
-      const char * t = ".";
-      const char * n = ".";
+      const char * f = 0;
+      const char * t = 0;
+      const char * n = 0;
 
       for_( ch, line_r.c_str(), ch+line_r.size() )
       {
@@ -110,7 +109,6 @@ namespace zypp
           case 'k':
             if ( *(ch+1) != '0' )      // skip non-zero link counts
               return;
-            k = ch+1;
             break;
           case 'f':
             f = ch+1;
@@ -141,6 +139,9 @@ namespace zypp
 
       std::string name( n );
 
+      if ( str::contains( n, "(stat: Permission denied)" ) )
+        return;        // Avoid reporting false positive due to insufficient permission.
+
       if ( *f == 'm' || *f == 'D' )    // skip some wellknown nonlibrary memorymapped files
       {
         static const char * black[] = {