aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/recordmcount.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c
index ebe98c39f3cd..c0dd46344063 100644
--- a/scripts/recordmcount.c
+++ b/scripts/recordmcount.c
@@ -89,7 +89,7 @@ succeed_file(void)
longjmp(jmpenv, SJ_SUCCEED);
}
-/* ulseek, uread, ...: Check return value for errors. */
+/* ulseek, uwrite, ...: Check return value for errors. */
static off_t
ulseek(int const fd, off_t const offset, int const whence)
@@ -113,17 +113,6 @@ ulseek(int const fd, off_t const offset, int const whence)
}
static size_t
-uread(int const fd, void *const buf, size_t const count)
-{
- size_t const n = read(fd, buf, count);
- if (n != count) {
- perror("read");
- fail_file();
- }
- return n;
-}
-
-static size_t
uwrite(int const fd, void const *const buf, size_t const count)
{
size_t cnt = count;
@@ -298,7 +287,10 @@ static void *mmap_file(char const *fname)
if (file_map == MAP_FAILED) {
mmap_failed = 1;
file_map = umalloc(sb.st_size);
- uread(fd_map, file_map, sb.st_size);
+ if (read(fd_map, file_map, sb.st_size) != sb.st_size) {
+ perror(fname);
+ fail_file();
+ }
}
close(fd_map);