From 024108eecd2ef03a843cf42e3d45c0db11e4fc75 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Sat, 8 Nov 2014 23:14:09 +0100 Subject: set: check seek success This could silently fail which leads to surprising behaviour. Found-by: Coverity Scan Signed-off-by: Patrick Georgi Signed-off-by: Thierry Reding --- src/set.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/set.c b/src/set.c index ff32b53..0af6686 100644 --- a/src/set.c +++ b/src/set.c @@ -59,7 +59,11 @@ read_from_image(char *filename, return result; } - fseek(fp, offset, SEEK_SET); + if (fseek(fp, offset, SEEK_SET) == -1) { + printf("Error: Couldn't seek to %s(%d)\n", filename, offset); + result = 1; + goto cleanup; + } if (stat(filename, &stats) != 0) { printf("Error: Unable to query info on bootloader path %s\n", -- cgit v1.2.1