From 693b157c3e290bd72588be058b1fc61429ceb3dd Mon Sep 17 00:00:00 2001 From: Matthias Gerstner Date: Thu, 4 Jun 2020 15:59:08 +0200 Subject: [PATCH] v4l-conf: use the same error messages for stat() and type errors Only this way arbitrary file existence tests can be avoided. Otherwise an unprivileged user will get different messages for existing files of the wrong type than for non-existing files. --- console/v4l-conf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/console/v4l-conf.c b/console/v4l-conf.c index 0e8d3e3..aee5bda 100644 --- a/console/v4l-conf.c +++ b/console/v4l-conf.c @@ -143,12 +143,12 @@ dev_open(const char *device, int major) /* First check if the device is really a devnode of the right type */ if (-1 == stat(device, &stb)) { - fprintf(stderr, "stat failed on %s\n", device); + fprintf(stderr, "%s: invalid path or file is not of the right type\n", device); exit(1); } if (!S_ISCHR(stb.st_mode) || (major(stb.st_rdev) != major)) { - fprintf(stderr, "%s: wrong device\n", device); + fprintf(stderr, "%s: invalid path or file is not of the right type\n", device); exit(1); } -- 2.26.2