diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-01-24 23:40:45 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-02-09 22:13:18 +0100 |
commit | 24b0e6277b36c46075e2e23896aa9ec43729efab (patch) | |
tree | aee635ca55a8b59f1551734eb93dac6a3a7239fa /misc-utils/recv_image.c | |
parent | 4233a39933277b0d715d59d72942a8fd65bcec4a (diff) |
mtd-utils: Fix some simple cases of uninitialized value reads
This patch modifies the internal helpers to read and parse integers
from sysfs files by initializing them first and removes turns an
obscure "a = open(...) if (a >= 0) {...} if (a == -1) {...}" inside
recv_image into a more straight forward if/else branch.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'misc-utils/recv_image.c')
-rw-r--r-- | misc-utils/recv_image.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/misc-utils/recv_image.c b/misc-utils/recv_image.c index 7f6662b..eeaa2e2 100644 --- a/misc-utils/recv_image.c +++ b/misc-utils/recv_image.c @@ -81,8 +81,7 @@ int main(int argc, char **argv) printf("Receive to MTD device %s with erasesize %d\n", argv[3], meminfo.erasesize); } - } - if (flfd == -1) { + } else { /* Try again, as if it's a file */ flfd = open(argv[3], O_CREAT|O_TRUNC|O_RDWR, 0644); if (flfd < 0) { |