From cbd7ad13a3eb3b424ae319a2a7486fd64fed24a0 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 10 Mar 2026 10:35:51 +0000 Subject: 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 --- util/nvmutil/nvmutil.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'util/nvmutil') 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 -- cgit v1.2.1