From a6221519650f8b065f50d665e0ef9d683ad66703 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 16 Mar 2026 21:07:49 +0000 Subject: util/nvmutil: dir fsync with O_DIRECTORY guards against replacement attacks, on systems that support this flag Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'util/nvmutil') diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 8fff62e4..ce4011c1 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -2150,7 +2150,11 @@ fsync_dir(const char *path) strcpy(dirbuf, "."); } - dfd = open(dirbuf, O_RDONLY); + dfd = open(dirbuf, O_RDONLY +#ifdef O_DIRECTORY + | O_DIRECTORY +#endif + ); if (dfd == -1) goto err_fsync_dir; -- cgit v1.2.1