PengZheng commented on code in PR #602: URL: https://github.com/apache/celix/pull/602#discussion_r1282544754
########## libs/framework/src/bundle_archive.c: ########## @@ -97,6 +97,35 @@ static celix_status_t celix_bundleArchive_storeBundleStateProperties(bundle_arch return CELIX_SUCCESS; } +static celix_status_t celix_bundleArchive_removeResourceCache(bundle_archive_t* archive) { + celix_status_t status = CELIX_SUCCESS; + const char* error = NULL; + struct stat st; + status = lstat(archive->resourceCacheRoot, &st); + if (status == -1 && errno == ENOENT) { + return CELIX_SUCCESS; + } else if(status == -1 && errno != ENOENT) { + status = CELIX_ERROR_MAKE(CELIX_FACILITY_CERRNO,errno); + fw_logCode(archive->fw->logger, CELIX_LOG_LEVEL_ERROR, status, "Failed to stat bundle archive directory '%s'", archive->resourceCacheRoot); + return status; + } + // assert(status == 0); Review Comment: Fixed. ########## libs/framework/src/celix_bundle_cache.c: ########## @@ -228,30 +230,26 @@ celix_status_t celix_bundleCache_createSystemArchive(celix_framework_t* fw, bund return celix_bundleCache_createArchive(fw->cache, CELIX_FRAMEWORK_BUNDLE_ID, NULL, archive); } -celix_status_t celix_bundleCache_destroyArchive(celix_bundle_cache_t* cache, bundle_archive_pt archive, bool permanent) { - celix_status_t status = CELIX_SUCCESS; - const char* loc = NULL; +void celix_bundleCache_destroyArchive(celix_bundle_cache_t* cache, bundle_archive_pt archive) { celixThreadMutex_lock(&cache->mutex); - (void) bundleArchive_getLocation(archive, &loc); - (void) celix_stringHashMap_remove(cache->locationToBundleIdLookupMap, loc); - if (permanent) { - status = bundleArchive_closeAndDelete(archive); + if (!celix_bundleArchive_isCacheValid(archive)) { + const char* loc = NULL; + (void) bundleArchive_getLocation(archive, &loc); + (void) celix_stringHashMap_remove(cache->locationToBundleIdLookupMap, loc); } + (void)celix_bundleArchive_removeInvalidDirs(archive); celixThreadMutex_unlock(&cache->mutex); - (void) bundleArchive_destroy(archive); - return status; + bundleArchive_destroy(archive); } /** * Update location->bundle id lookup map. */ static void celix_bundleCache_updateIdForLocationLookupMap(celix_bundle_cache_t* cache) { Review Comment: Fixed -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@celix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org