X-Git-Url: http://gitweb/?a=blobdiff_plain;f=pkgutil.cc;h=943c420f23a9d807b1fac599fc00dbe2a20899b3;hb=bfb5480be95ac565f1a057750429857385478be9;hp=ce945017f360762dbb05ea86af085d59ddbdba69;hpb=80db05ef8d1a1ce7d7948a9d06732209f5f84fce;p=pkgutils-cross.git diff --git a/pkgutil.cc b/pkgutil.cc index ce94501..943c420 100644 --- a/pkgutil.cc +++ b/pkgutil.cc @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -422,8 +421,9 @@ void pkgutil::pkg_install(const string& filename, const set& keep_list, (real_filename.c_str())); // Extract file - if (archive_read_extract(archive, entry, 0) != - ARCHIVE_OK) { + unsigned int flags = ARCHIVE_EXTRACT_OWNER | ARCHIVE_EXTRACT_PERM | ARCHIVE_EXTRACT_UNLINK; + + if (archive_read_extract(archive, entry, flags) != ARCHIVE_OK) { // If a file fails to install we just print an error message and // continue trying to install the rest of the package. const char* msg = archive_error_string(archive); @@ -698,42 +698,6 @@ string mtos(mode_t mode) return s; } -int unistd_gzopen(char* pathname, int flags, mode_t mode) -{ - char* gz_mode; - - switch (flags & O_ACCMODE) { - case O_WRONLY: - gz_mode = "w"; - break; - - case O_RDONLY: - gz_mode = "r"; - break; - - case O_RDWR: - default: - errno = EINVAL; - return -1; - } - - int fd; - gzFile gz_file; - - if ((fd = open(pathname, flags, mode)) == -1) - return -1; - - if ((flags & O_CREAT) && fchmod(fd, mode)) - return -1; - - if (!(gz_file = gzdopen(fd, gz_mode))) { - errno = ENOMEM; - return -1; - } - - return (int)gz_file; -} - string trim_filename(const string& filename) { string search("//");