diff -Naurp --exclude-from excludes old/libsemanage/src/direct_api.c new/libsemanage/src/direct_api.c --- old/libsemanage/src/direct_api.c 2006-02-08 03:20:08.000000000 -0500 +++ new/libsemanage/src/direct_api.c 2006-02-09 19:14:15.000000000 -0500 @@ -475,7 +475,7 @@ static int semanage_direct_commit(semana /* ==================== File-backed ================== */ - /* write the linked file contexts template */ + /* File Contexts */ if ((ofilename = semanage_path(SEMANAGE_TMP, SEMANAGE_FC_TMPL)) == NULL || write_file(sh, ofilename, sepol_module_package_get_file_contexts(base), sepol_module_package_get_file_contexts_len(base)) == -1) { @@ -484,29 +484,36 @@ static int semanage_direct_commit(semana if (semanage_split_fc(sh)) goto cleanup; - + + pfcontexts->dtable->drop_cache(pfcontexts->dbase); + + /* Seusers */ if (sepol_module_package_get_seusers_len(base)) { if ((ofilename = semanage_path(SEMANAGE_TMP, SEMANAGE_SEUSERS)) == NULL || write_file(sh, ofilename, sepol_module_package_get_seusers(base), sepol_module_package_get_seusers_len(base)) == -1) { goto cleanup; } + pseusers->dtable->drop_cache(pseusers->dbase); + + } else { + if (pseusers->dtable->clear(sh, pseusers->dbase) < 0) + goto cleanup; } + /* Users_extra */ if (sepol_module_package_get_user_extra_len(base)) { if ((ofilename = semanage_path(SEMANAGE_TMP, SEMANAGE_USER_EXTRA)) == NULL || write_file(sh, ofilename, sepol_module_package_get_user_extra(base), sepol_module_package_get_user_extra_len(base)) == -1) { goto cleanup; } - } + pusers_extra->dtable->drop_cache(pusers_extra->dbase); - /* Drop any cached content for file_contexts, seusers, or users_extra, - * since it is now superceded by the files just written, and needs to be - * re-cached */ - pfcontexts->dtable->drop_cache(pfcontexts->dbase); - pseusers->dtable->drop_cache(pseusers->dbase); - pusers_extra->dtable->drop_cache(pusers_extra->dbase); + } else { + if (pusers_extra->dtable->clear(sh, pusers_extra->dbase) < 0) + goto cleanup; + } /* ==================== Policydb-backed ================ */