summaryrefslogtreecommitdiffstats
path: root/src/ctx.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-11-09 11:35:53 -0500
committerTavian Barnes <tavianator@tavianator.com>2022-11-09 12:09:45 -0500
commitfc63f1b33fb438e8f7690db9bd84e3c69fe86b51 (patch)
tree79ad74fee5a8f922a6b19714affdcdbc26a317c1 /src/ctx.c
parentb41dca52762c5188638236ae81b9f4597bb29ac9 (diff)
downloadbfs-fc63f1b33fb438e8f7690db9bd84e3c69fe86b51.tar.xz
ctx: Flush the user/group caches when executing commands
This fixes (admittedly uncommon) commands like $ bfs -nouser -exec add-missing-user.sh {} \;
Diffstat (limited to 'src/ctx.c')
-rw-r--r--src/ctx.c5
1 files changed, 5 insertions, 0 deletions
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. */