try to fix crash reading cache
authorDuncan Mac-Vicar P <dmacvicar@suse.de>
Wed, 22 Feb 2006 09:59:22 +0000 (09:59 +0000)
committerDuncan Mac-Vicar P <dmacvicar@suse.de>
Wed, 22 Feb 2006 09:59:22 +0000 (09:59 +0000)
zypp/source/susetags/SuseTagsImpl.cc

index 7883c15c3e1a38bbe509098528855b315792e0e9..cd345ed303f2d5129aeec7565ef28a1643fe1b18 100644 (file)
@@ -105,21 +105,26 @@ namespace zypp
   
         std::string vendor;
         std::string media_id;
-
-        // dont initialize media if we are reading from cache
-        if ( cacheExists() )
-          return;
+        bool cache = cacheExists();
         
         try {
           media::MediaAccessId _media = _media_set->getMediaAccessId(1);
           Pathname media_file = Pathname("media.1/media");
-          media_mgr.provideFile (_media, media_file);
-          media_file = media_mgr.localPath (_media, media_file);
+          
+          if (cache)
+          {
+            media_file = _cache_dir + "MEDIA" + media_file; 
+          }
+          else
+          {
+            media_mgr.provideFile (_media, media_file);
+            media_file = media_mgr.localPath (_media, media_file);
+          }
     
           std::ifstream pfile( media_file.asString().c_str() );
 
           if ( pfile.bad() ) {
-            ERR << "Error parsing media.1/media" << endl;
+            ERR << "Error parsing media.1/media from file" << media_file << endl;
             ZYPP_THROW(Exception("Error parsing media.1/media") );
           }