From fc63f1b33fb438e8f7690db9bd84e3c69fe86b51 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 9 Nov 2022 11:35:53 -0500 Subject: ctx: Flush the user/group caches when executing commands This fixes (admittedly uncommon) commands like $ bfs -nouser -exec add-missing-user.sh {} \; --- src/ctx.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/ctx.c') diff --git a/src/ctx.c b/src/ctx.c index 8d80691..4b373a1 100644 --- a/src/ctx.c +++ b/src/ctx.c @@ -186,6 +186,11 @@ void bfs_ctx_flush(const struct bfs_ctx *ctx) { // We do not check errors here, but they will be caught at cleanup time // with ferror(). fflush(NULL); + + // Flush the user/group caches, in case the executed command edits the + // user/group tables + bfs_users_flush(ctx->users); + bfs_groups_flush(ctx->groups); } /** Flush a file and report any errors. */ -- cgit v1.2.3