diff options
author | Dan McGee <dan@archlinux.org> | 2009-01-03 07:18:22 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2009-01-03 07:18:22 +0100 |
commit | a30bf868ca4cce5464f7e4aa55cd7e7d4eade9a2 (patch) | |
tree | b1bf8a4c75855b7a3a61861ad20ff690fb5ad460 /lib | |
parent | 1cc8ad6112ed07a71f356a6bb0f06f117b36b3b2 (diff) | |
parent | a73ad4f0e3981acab7234e4b17a08a52bd273ab9 (diff) | |
download | pacman-a30bf868ca4cce5464f7e4aa55cd7e7d4eade9a2.tar.gz pacman-a30bf868ca4cce5464f7e4aa55cd7e7d4eade9a2.tar.xz |
Merge branch 'maint'
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libalpm/add.c | 10 | ||||
-rw-r--r-- | lib/libalpm/be_files.c | 24 | ||||
-rw-r--r-- | lib/libalpm/db.h | 1 | ||||
-rw-r--r-- | lib/libalpm/remove.c | 1 |
4 files changed, 33 insertions, 3 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index 50405895..b0a7671b 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -697,6 +697,16 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count, } } + /* prepare directory for database entries so permission are correct after + changelog/install script installation (FS#12263) */ + if(_alpm_db_prepare(db, newpkg)) { + alpm_logaction("error: could not create database entry %s-%s\n", + alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg)); + pm_errno = PM_ERR_DB_WRITE; + ret = -1; + goto cleanup; + } + if(!(trans->flags & PM_TRANS_FLAG_DBONLY)) { struct archive *archive; struct archive_entry *entry; diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c index b9ff6464..31b23172 100644 --- a/lib/libalpm/be_files.c +++ b/lib/libalpm/be_files.c @@ -652,6 +652,26 @@ error: return(-1); } +int _alpm_db_prepare(pmdb_t *db, pmpkg_t *info) +{ + mode_t oldmask; + int retval = 0; + char *pkgpath = NULL; + + oldmask = umask(0000); + + pkgpath = get_pkgpath(db, info); + + if((retval = mkdir(pkgpath, 0755)) != 0) { + _alpm_log(PM_LOG_ERROR, _("could not create directory %s: %s\n"), pkgpath, strerror(errno)); + } + + free(pkgpath); + umask(oldmask); + + return(retval); +} + int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq) { FILE *fp = NULL; @@ -670,10 +690,8 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq) pkgpath = get_pkgpath(db, info); - oldmask = umask(0000); - mkdir(pkgpath, 0755); /* make sure we have a sane umask */ - umask(0022); + oldmask = umask(0022); if(strcmp(db->treename, "local") == 0) { local = 1; diff --git a/lib/libalpm/db.h b/lib/libalpm/db.h index 96fac0dd..25b90b5f 100644 --- a/lib/libalpm/db.h +++ b/lib/libalpm/db.h @@ -60,6 +60,7 @@ int _alpm_db_open(pmdb_t *db); void _alpm_db_close(pmdb_t *db); int _alpm_db_populate(pmdb_t *db); int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq); +int _alpm_db_prepare(pmdb_t *db, pmpkg_t *info); int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq); int _alpm_db_remove(pmdb_t *db, pmpkg_t *info); diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index f0734902..76bb5525 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -285,6 +285,7 @@ static void unlink_file(pmpkg_t *info, alpm_list_t *lp, pmtrans_t *trans) snprintf(newpath, PATH_MAX, "%s.pacsave", file); rename(file, newpath); _alpm_log(PM_LOG_WARNING, _("%s saved as %s\n"), file, newpath); + alpm_logaction("warning: %s saved as %s\n", file, newpath); return; } else { _alpm_log(PM_LOG_DEBUG, "transaction is set to NOSAVE, not backing up '%s'\n", file); |