From 74543d376df97ce44a3b6f8541b13a8459a48f0d Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 25 Aug 2021 15:01:44 +0200 Subject: [PATCH] linux: silence two false positives reported by lgtm The code is working on the /proc/self/fd/$FD path so there is no risk of a race condition. Signed-off-by: Giuseppe Scrivano --- src/libcrun/linux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libcrun/linux.c b/src/libcrun/linux.c index 9d246dc..1889469 100644 --- a/src/libcrun/linux.c +++ b/src/libcrun/linux.c @@ -1101,7 +1101,7 @@ create_dev (libcrun_container_t *container, int devfd, struct device_s *device, if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "fchmodat `%s`", device->path); - ret = chown (fd_buffer, device->uid, device->gid); + ret = chown (fd_buffer, device->uid, device->gid); /* lgtm [cpp/toctou-race-condition] */ if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "chown `%s`", device->path); } @@ -1149,7 +1149,7 @@ create_dev (libcrun_container_t *container, int devfd, struct device_s *device, if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "chmod `%s`", device->path); - ret = chown (fd_buffer, device->uid, device->gid); + ret = chown (fd_buffer, device->uid, device->gid); /* lgtm [cpp/toctou-race-condition] */ if (UNLIKELY (ret < 0)) return crun_make_error (err, errno, "chown `%s`", device->path); }