diff options
| author | Leah Rowe <leah@libreboot.org> | 2026-03-10 10:35:51 +0000 |
|---|---|---|
| committer | Leah Rowe <leah@libreboot.org> | 2026-03-10 10:35:51 +0000 |
| commit | cbd7ad13a3eb3b424ae319a2a7486fd64fed24a0 (patch) | |
| tree | 5d0f59166465751031853c74ab6ca1f638b210ad /util | |
| parent | 91a6395e5cbfd70f5227d1a6b347444dcb7dea5f (diff) | |
util/nvmutil: check whether a file is a file
and not, say, a socket or a directory, or
a character device, or something else.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util')
| -rw-r--r-- | util/nvmutil/nvmutil.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 71e16f46..3eb1cd8c 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -745,6 +745,9 @@ xopen(int *fd_ptr, const char *path, int flags, struct stat *st) if (fstat(*fd_ptr, st) == -1) err(ECANCELED, "%s", path); + + if (!S_ISREG(st->st_mode)) + err(ECANCELED, "%s: not a regular file", path); } static void |
