提交 6670e9cd 编写于 作者: D Daniel J Blueman 提交者: H. Peter Anvin

x86, build: Make sure mkpiggy fails on read error

Ensure build doesn't silently continue despite read failure,
addressing a warning due to the unchecked call.
Signed-off-by: NDaniel J Blueman <daniel.blueman@gmail.com>
LKML-Reference: <AANLkTimxxTMU3=4ry-_zbY6v1xiDi+hW9y1RegTr8vLK@mail.gmail.com>
Signed-off-by: NH. Peter Anvin <hpa@linux.intel.com>
上级 dd9c1549
...@@ -62,7 +62,12 @@ int main(int argc, char *argv[]) ...@@ -62,7 +62,12 @@ int main(int argc, char *argv[])
if (fseek(f, -4L, SEEK_END)) { if (fseek(f, -4L, SEEK_END)) {
perror(argv[1]); perror(argv[1]);
} }
fread(&olen, sizeof olen, 1, f);
if (fread(&olen, sizeof(olen), 1, f) != 1) {
perror(argv[1]);
return 1;
}
ilen = ftell(f); ilen = ftell(f);
olen = getle32(&olen); olen = getle32(&olen);
fclose(f); fclose(f);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册