aboutsummaryrefslogtreecommitdiffstats
path: root/src/database.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2015-06-26 16:28:22 +0300
committerTimo Teräs <timo.teras@iki.fi>2015-06-26 16:28:22 +0300
commit68453b99e68e8bc8454956cdcbbf6d0a520d666f (patch)
treee7455ef0bead42991d497b64824568e94135a967 /src/database.c
parent9dd161c2b4aa003368b4c0ac1d02ed5790415221 (diff)
remove db dir entry properly, so it can be recreated properly if needed
fixes #4261
Diffstat (limited to 'src/database.c')
-rw-r--r--src/database.c14
1 files changed, 7 insertions, 7 deletions
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)