diff options
author | Horms <horms@verge.net.au> | 2006-12-11 14:25:56 +0900 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2006-12-12 17:55:49 +0900 |
commit | 6a33ef415ec36725eb307adc3666852155a0d7bf (patch) | |
tree | a5ca68979ee7460dc1baa5c54c4ac6802f4e6e84 /kexec | |
parent | 1fd7cb01165e301789566e6a19344972e0595457 (diff) |
kexec-tools: ppc64: Check lseek return for errors
Check the call to lseek in
kexec/arch/ppc64/fs2dt.c:add_usable_mem_property-lseek() for
errors.
Appart from being a good idea, this is a preparatory patch to remove
the farily bogus scemantic of checking and setting errno some time later in
functions in kexec/arch/ppc64/fs2dt.c to see if an error occured somewhere.
Signed-off-by: Simon Horman <horms@verge.net.au>
Tested and working fine. Ack.
Acked-by: Sachin P. Sant <sachinp@in.ibm.com>
Diffstat (limited to 'kexec')
-rw-r--r-- | kexec/arch/ppc64/fs2dt.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/kexec/arch/ppc64/fs2dt.c b/kexec/arch/ppc64/fs2dt.c index 9518e73..8e24f18 100644 --- a/kexec/arch/ppc64/fs2dt.c +++ b/kexec/arch/ppc64/fs2dt.c @@ -123,7 +123,9 @@ static void add_usable_mem_property(int fd, int len) if (strncmp(bname, "/memory@", 8)) return; - lseek(fd, 0, SEEK_SET); + if (lseek(fd, 0, SEEK_SET) < 0) + die("unrecoverable error: error seeking in \"%s\": %s\n", + pathname, strerror(errno)); if (read(fd, buf, len) != len) die("unrecoverable error: error reading \"%s\": %s\n", pathname, strerror(errno)); |