@@ -117,7 +117,7 @@ static int elf_header_read(struct elf_file *elf)
117117 /* read in elf header */
118118 count = fread (& elf -> header , sizeof (elf -> header ), 1 , elf -> file );
119119 if (count != 1 ) {
120- if (count < 0 )
120+ if (! count )
121121 return file_error ("failed to read elf header" , elf -> filename );
122122 else
123123 return elf_error (elf , "Corrupted file." , ENODATA );
@@ -199,7 +199,7 @@ static int elf_section_headers_read(struct elf_file *elf)
199199
200200 count = fread (& elf -> sections [i ].data , sizeof (Elf32_Shdr ), 1 , elf -> file );
201201 if (count != 1 ) {
202- if (count < 0 )
202+ if (! count )
203203 return file_error ("failed to read section header" , elf -> filename );
204204 else
205205 return elf_error (elf , "Corrupted file." , ENODATA );
@@ -264,7 +264,7 @@ static int elf_program_headers_read(struct elf_file *elf)
264264
265265 count = fread (& elf -> programs [i ], sizeof (Elf32_Phdr ), 1 , elf -> file );
266266 if (count != 1 ) {
267- if (count < 0 )
267+ if (! count )
268268 return file_error ("failed to read program header" , elf -> filename );
269269 else
270270 return elf_error (elf , "Corrupted file." , ENODATA );
@@ -467,7 +467,7 @@ int elf_section_read_content(const struct elf_file *elf, const struct elf_sectio
467467
468468 count = fread (buffer , header -> data .size , 1 , elf -> file );
469469 if (count != 1 ) {
470- if (count < 0 )
470+ if (! count )
471471 return file_error ("failed to read section data" , elf -> filename );
472472 else
473473 return elf_error (elf , "Corrupted file." , ENODATA );
0 commit comments