]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev/v4l_id: use O_CLOEXEC|O_NOCTTY
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 16 Mar 2023 15:40:00 +0000 (16:40 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 16 Mar 2023 15:46:44 +0000 (16:46 +0100)
This is the usual set of flags. O_CLOEXEC doesn't matter because we don't spawn
anything, but O_NOCTTY could possibly make a difference if the helper is called
on a wrong device type.

src/udev/v4l_id/v4l_id.c

index 1d176a387e5145724bef8359f4fa34dec2b7c206..30527e9556d4c95878c95f11bee49b3351fa61e1 100644 (file)
@@ -74,7 +74,7 @@ static int run(int argc, char *argv[]) {
         if (r <= 0)
                 return r;
 
-        fd = open(arg_device, O_RDONLY);
+        fd = open(arg_device, O_RDONLY|O_CLOEXEC|O_NOCTTY);
         if (fd < 0)
                 return log_error_errno(errno, "Failed to open %s: %m", arg_device);