Fix unsigned conversion bug.

Since readi() returns -1 for errors, checking with < against an unsigned
value is inadvisable. Checking with != works as intended however.
This commit is contained in:
Peter H. Froehlich 2016-09-27 16:58:29 -04:00 committed by Frans Kaashoek
parent 462930727f
commit e916d668f7

2
exec.c
View file

@ -28,7 +28,7 @@ exec(char *path, char **argv)
pgdir = 0; pgdir = 0;
// Check ELF header // Check ELF header
if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf)) if(readi(ip, (char*)&elf, 0, sizeof(elf)) != sizeof(elf))
goto bad; goto bad;
if(elf.magic != ELF_MAGIC) if(elf.magic != ELF_MAGIC)
goto bad; goto bad;