btf_encoder: Fix signed/unsigned comparision

Since the 'int' variable, 'err' was just checked for < 0, cast it to
uint32_t and compare with the 'uint32_t' one.

Fixes this clang warning:

  /var/home/acme/git/pahole/btf_encoder.c: In function ‘btf_encoder__write_raw_file’:
  /var/home/acme/git/pahole/btf_encoder.c:890:17: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare]
    890 |         if (err != raw_btf_size) {
        |                 ^~

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2021-08-05 16:23:44 -03:00
parent 8d2efa2b6c
commit 8634d8535f
1 changed files with 1 additions and 1 deletions

View File

@ -887,7 +887,7 @@ static int btf_encoder__write_raw_file(struct btf_encoder *encoder)
close(fd);
if (err != raw_btf_size) {
if ((uint32_t)err != raw_btf_size) {
fprintf(stderr, "%s: Could only write %d bytes to %s of raw BTF info out of %d, aborting\n", __func__, err, filename, raw_btf_size);
unlink(filename);
err = -1;