mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 09:38:07 +02:00
freedreno: Check file descriptor before write.
Fix defect reported by Coverity Scan.
Argument cannot be negative (NEGATIVE_RETURNS)
negative_returns: fd is passed to a parameter that cannot be
negative.
Fixes: 1ea4ef0d3b ("freedreno: slurp in decode tools")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6696>
This commit is contained in:
parent
50f1cd4076
commit
e607477d7c
1 changed files with 4 additions and 2 deletions
|
|
@ -403,8 +403,10 @@ dump_shader(const char *ext, void *buf, int bufsz)
|
|||
int fd;
|
||||
sprintf(filename, "%04d.%s", n++, ext);
|
||||
fd = open(filename, O_WRONLY| O_TRUNC | O_CREAT, 0644);
|
||||
write(fd, buf, bufsz);
|
||||
close(fd);
|
||||
if (fd != -1) {
|
||||
write(fd, buf, bufsz);
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue