From 00454ab087774a62b314805b51215bba81a99aa8 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Tue, 9 Apr 2024 13:25:55 -0400 Subject: [PATCH] examples/ezusb: Replace rewind with fseek, to check for errors Replace rewind, which gives no error result, with fseek, which does. Fixes all clang-tidy bugprone-unsafe-functions warnings References #1479 --- .clang-tidy | 1 - examples/ezusb.c | 7 ++++++- libusb/version_nano.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 6349aa8..88c9507 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -13,7 +13,6 @@ bugprone-*,\ -bugprone-signed-char-misuse,\ -bugprone-suspicious-string-compare,\ -bugprone-switch-missing-default-case,\ --bugprone-unsafe-functions,\ -bugprone-too-small-loop-variable,\ clang-analyzer-*,\ -clang-analyzer-core.NullDereference,\ diff --git a/examples/ezusb.c b/examples/ezusb.c index 4bed12a..242968f 100644 --- a/examples/ezusb.c +++ b/examples/ezusb.c @@ -815,7 +815,12 @@ int ezusb_load_ram(libusb_device_handle *device, const char *path, int fx_type, } /* at least write the interrupt vectors (at 0x0000) for reset! */ - rewind(image); + status = fseek(image, 0L, SEEK_SET); + if (ret < 0) { + logerror("unable to rewind file %s\n", path); + ret = status; + goto exit; + } if (verbose) logerror("2nd stage: write on-chip memory\n"); status = parse_ihex(image, &ctx, is_external, ram_poke); diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 8cad994..2453eeb 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11913 +#define LIBUSB_NANO 11914