CRUX-ARM : Home

Home :: Documentation :: Download :: Development :: Community :: Ports :: Packages :: Bugs :: Links :: About :: Donors
Bug #244: Relative paths are supported now in pkgadd -r.
authorLucas Hazel <lucas@die.net.au>
Fri, 11 Apr 2008 16:18:09 +0000 (18:18 +0200)
committerTilman Sauerbeck <tilman@crux.nu>
Fri, 11 Apr 2008 16:19:09 +0000 (18:19 +0200)
pkgutil.cc

index 216ca531de2dd92d507d474b42b5d3f8ccc70aad..709e7488493143cee0d9e9fde22184d7b4d39dc2 100644 (file)
@@ -384,6 +384,8 @@ void pkgutil::pkg_install(const string& filename, const set<string>& keep_list,
        struct archive* archive;
        struct archive_entry* entry;
        unsigned int i;
+       char buf[PATH_MAX];
+       string absroot;
 
        archive = archive_read_new();
        INIT_ARCHIVE(archive);
@@ -394,12 +396,13 @@ void pkgutil::pkg_install(const string& filename, const set<string>& keep_list,
                throw runtime_error_with_errno("could not open " + filename, archive_errno(archive));
 
        chdir(root.c_str());
+       absroot = getcwd(buf, sizeof(buf));
 
        for (i = 0; archive_read_next_header(archive, &entry) ==
             ARCHIVE_OK; ++i) {
                string archive_filename = archive_entry_pathname(entry);
-               string reject_dir = trim_filename(root + string("/") + string(PKG_REJECTED));
-               string original_filename = trim_filename(root + string("/") + archive_filename);
+               string reject_dir = trim_filename(absroot + string("/") + string(PKG_REJECTED));
+               string original_filename = trim_filename(absroot + string("/") + archive_filename);
                string real_filename = original_filename;
 
                // Check if file is filtered out via INSTALL