diff options
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/savecore/savecore.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c index b87b95b..0c1e806 100644 --- a/sbin/savecore/savecore.c +++ b/sbin/savecore/savecore.c @@ -491,9 +491,8 @@ DoFile(const char *savedir, const char *device) } lasthd = mediasize - sectorsize; - lseek(fd, lasthd, SEEK_SET); - error = read(fd, &kdhl, sizeof kdhl); - if (error != sizeof kdhl) { + if (lseek(fd, lasthd, SEEK_SET) != lasthd || + read(fd, &kdhl, sizeof(kdhl)) != sizeof(kdhl)) { syslog(LOG_ERR, "error reading last dump header at offset %lld in %s: %m", (long long)lasthd, device); @@ -569,9 +568,8 @@ DoFile(const char *savedir, const char *device) } dumpsize = dtoh64(kdhl.dumplength); firsthd = lasthd - dumpsize - sizeof kdhf; - lseek(fd, firsthd, SEEK_SET); - error = read(fd, &kdhf, sizeof kdhf); - if (error != sizeof kdhf) { + if (lseek(fd, firsthd, SEEK_SET) != firsthd || + read(fd, &kdhf, sizeof(kdhf)) != sizeof(kdhf)) { syslog(LOG_ERR, "error reading first dump header at offset %lld in %s: %m", (long long)firsthd, device); |