From 3d3df07c45d5e818a493b75a6da3df9105aa6b42 Mon Sep 17 00:00:00 2001 From: Vencislav Atanasov Date: Mon, 29 Jun 2026 21:30:13 +0300 Subject: [PATCH] bspatch: Fix compile warnings on Apple Clang 21 - signed/unsigned comparisons - unambiguous fclose() result code handling Co-authored-by: ChatGPT (GPT-5.3 Mini) Change-Id: I6c4184ddef39281610de01b5c6ab402450d9a3ec --- utils/bspatch/bspatch.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/bspatch/bspatch.c b/utils/bspatch/bspatch.c index d1d7a5aa7a..fe736213f0 100644 --- a/utils/bspatch/bspatch.c +++ b/utils/bspatch/bspatch.c @@ -147,8 +147,8 @@ int apply_bspatch(const char *infile, const char *outfile, const char *patchfile pold = (u_char *)malloc(oldsize + 1); if (pold == NULL) err(1, "Malloc failed :%s", infile); fseek(fs, 0, SEEK_SET); - if (fread(pold, 1, oldsize, fs) == -1) err(1, "Read failed :%s", infile); - if (fclose(fs) == -1) err(1, "Close failed :%s", infile); + if (fread(pold, 1, oldsize, fs) != (size_t)oldsize) err(1, "Read failed :%s", infile); + if (fclose(fs) != 0) err(1, "Close failed :%s", infile); pnew = malloc(newsize + 1); if (pnew == NULL)err(1, NULL); @@ -208,8 +208,8 @@ int apply_bspatch(const char *infile, const char *outfile, const char *patchfile /* Write the pnew file */ fs = fopen(outfile, "wb"); if (fs == NULL)err(1, "Create failed :%s", outfile); - if (fwrite(pnew, 1, newsize, fs) == -1)err(1, "Write failed :%s", outfile); - if (fclose(fs) == -1)err(1, "Close failed :%s", outfile); + if (fwrite(pnew, 1, newsize, fs) != (size_t)newsize)err(1, "Write failed :%s", outfile); + if (fclose(fs) != 0)err(1, "Close failed :%s", outfile); free(pnew); free(pold);