diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-01-24 23:01:57 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-02-09 22:13:18 +0100 |
commit | b636250e211198210ab996671bccc2983300c6f5 (patch) | |
tree | da1793fcd90dfd2b411afc1bc7cc2249b47c8e4f /nor-utils | |
parent | 11bc41c32cc933a141545be6a9729122ac436cfe (diff) |
mtd-utils: Fix potential negative arguments passed to close(2)
Many tools open a file descriptor, close it a the end and have some
form of error path in between that jumps to the end.
In some cases, if opening the file fails the error path is taken and
the utility ends up closing one or more invalid file descriptors. It's
technically not a real issue but something that pretty much any static
analysis tool barks at.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'nor-utils')
-rw-r--r-- | nor-utils/rfddump.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/nor-utils/rfddump.c b/nor-utils/rfddump.c index 4ad2f91..01ab4c2 100644 --- a/nor-utils/rfddump.c +++ b/nor-utils/rfddump.c @@ -324,7 +324,7 @@ int main(int argc, char *argv[]) return 0; err: - if (out_fd) + if (out_fd > 0) close(out_fd); close(fd); |