CRUX-ARM : Home

Home :: Documentation :: Download :: Development :: Community :: Ports :: Packages :: Bugs :: Links :: About :: Donors
Removed the libtar archive and patches.
[pkgutils-cross.git] / pkgutil.cc
index 39f68f5d3eb707c1fe7276f5ffe92c84d591fac5..33ee3015cdbeb9cab9e69924959de9232d1ffb4a 100644 (file)
@@ -349,7 +349,7 @@ pair<string, pkgutil::pkginfo_t> pkgutil::pkg_open(const string& filename) const
        if (archive_read_open_filename(archive,
            const_cast<char*>(filename.c_str()),
            ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK)
-               throw runtime_error_with_errno("could not open " + filename);
+               throw runtime_error_with_errno("could not open " + filename, archive_errno(archive));
 
        for (i = 0; archive_read_next_header(archive, &entry) ==
             ARCHIVE_OK; ++i) {
@@ -362,7 +362,7 @@ pair<string, pkgutil::pkginfo_t> pkgutil::pkg_open(const string& filename) const
 
                if (S_ISREG(status->st_mode) &&
                    archive_read_data_skip(archive) != ARCHIVE_OK)
-                       throw runtime_error_with_errno("could not read " + filename);
+                       throw runtime_error_with_errno("could not read " + filename, archive_errno(archive));
        }
    
        if (i == 0) {
@@ -390,7 +390,7 @@ void pkgutil::pkg_install(const string& filename, const set<string>& keep_list,
        if (archive_read_open_filename(archive,
            const_cast<char*>(filename.c_str()),
            ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK)
-               throw runtime_error_with_errno("could not open " + filename);
+               throw runtime_error_with_errno("could not open " + filename, archive_errno(archive));
 
        chdir(root.c_str());
 
@@ -488,7 +488,7 @@ void pkgutil::ldconfig() const
 
 void pkgutil::pkg_footprint(string& filename) const
 {
-        unsigned int i;
+       unsigned int i;
        struct archive* archive;
        struct archive_entry* entry;
 
@@ -499,7 +499,7 @@ void pkgutil::pkg_footprint(string& filename) const
        if (archive_read_open_filename(archive,
            const_cast<char*>(filename.c_str()),
            ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK)
-                throw runtime_error_with_errno("could not open " + filename);
+                throw runtime_error_with_errno("could not open " + filename, archive_errno(archive));
 
        for (i = 0; archive_read_next_header(archive, &entry) ==
             ARCHIVE_OK; ++i) {
@@ -557,17 +557,16 @@ void pkgutil::pkg_footprint(string& filename) const
 
                cout << '\n';
                
-               if (S_ISREG(status->st_mode) &&
-                   archive_read_data_skip(archive))
-                        throw runtime_error_with_errno("could not read " + filename);
-        }
+               if (S_ISREG(status->st_mode) && archive_read_data_skip(archive))
+                       throw runtime_error_with_errno("could not read " + filename, archive_errno(archive));
+       }
    
-        if (i == 0) {
+       if (i == 0) {
                if (archive_errno(archive) == 0)
-                        throw runtime_error("empty package");
-                else
-                        throw runtime_error("could not read " + filename);
-        }
+                       throw runtime_error("empty package");
+               else
+                       throw runtime_error("could not read " + filename);
+       }
 
        archive_read_finish(archive);
 }