From 68453b99e68e8bc8454956cdcbbf6d0a520d666f Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Fri, 26 Jun 2015 16:28:22 +0300 Subject: remove db dir entry properly, so it can be recreated properly if needed fixes #4261 --- src/database.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/database.c') diff --git a/src/database.c b/src/database.c index cafcfe8..7a9ab58 100644 --- a/src/database.c +++ b/src/database.c @@ -259,13 +259,13 @@ void apk_db_dir_unref(struct apk_database *db, struct apk_db_dir *dir, int rmdir if (--dir->refs > 0) return; db->installed.stats.dirs--; apk_protected_path_array_free(&dir->protected_paths); - if (dir->namelen == 0) return; - - if (rmdir_mode == APK_DIR_REMOVE && !(apk_flags & APK_SIMULATE)) - if (unlinkat(db->root_fd, dir->name, AT_REMOVEDIR)) - ; - - apk_db_dir_unref(db, dir->parent, rmdir_mode); + if (dir->namelen != 0) { + if (rmdir_mode == APK_DIR_REMOVE && !(apk_flags & APK_SIMULATE)) + if (unlinkat(db->root_fd, dir->name, AT_REMOVEDIR)) + ; + apk_db_dir_unref(db, dir->parent, rmdir_mode); + } + apk_hash_delete_hashed(&db->installed.dirs, APK_BLOB_PTR_LEN(dir->name, dir->namelen), dir->hash); } struct apk_db_dir *apk_db_dir_ref(struct apk_db_dir *dir) -- cgit v1.2.3-60-g2f50