util/nvmutil: dir fsync with O_DIRECTORY

guards against replacement attacks, on systems
that support this flag

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-16 21:07:49 +00:00
parent ddb0bc314d
commit 1207b1bb72
+5 -1
View File
@@ -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;