Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
linux: silence two false positives reported by lgtm
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
giuseppe committed Aug 25, 2021
1 parent 71da98d commit 74543d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libcrun/linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 74543d3

Please sign in to comment.