summaryrefslogtreecommitdiff
path: root/src/database.c
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-01-22 10:34:03 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-01-22 10:34:03 +0000
commit75b339cae217a14d51f674a25522e91aadf63a65 (patch)
treef47cdeb98553af3d8e12b1ac37af1ee308da53bc /src/database.c
parentdfc8d4ce4c6e8fdc30491d52e2014bd33d961dee (diff)
downloadapk-tools-75b339cae217a14d51f674a25522e91aadf63a65.tar.gz
apk-tools-75b339cae217a14d51f674a25522e91aadf63a65.tar.bz2
apk-tools-75b339cae217a14d51f674a25522e91aadf63a65.tar.xz
apk-tools-75b339cae217a14d51f674a25522e91aadf63a65.zip
db: always create directories during install
We dont care if a directory have references or not, we care if directory is relly there. Only the creator of the direcotry will set the permissions. This fixes the situation where you install a package owning a dir then you remove this dir manually and try install a second package also owning the dir. For example: apk add e2fsprogs-dev rm -rf /usr/lib/pkgconfig apk add zlib-dev
Diffstat (limited to 'src/database.c')
-rw-r--r--src/database.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/database.c b/src/database.c
index acc3acb..7a6ac8a 100644
--- a/src/database.c
+++ b/src/database.c
@@ -253,10 +253,8 @@ static void apk_db_diri_set(struct apk_db_dir_instance *diri, mode_t mode,
static void apk_db_diri_mkdir(struct apk_db_dir_instance *diri)
{
- if (diri->dir->refs == 1) {
- mkdir(diri->dir->dirname, diri->mode);
+ if (mkdir(diri->dir->dirname, diri->mode) == 0)
chown(diri->dir->dirname, diri->uid, diri->gid);
- }
}
static void apk_db_diri_rmdir(struct apk_db_dir_instance *diri)