summaryrefslogtreecommitdiff
path: root/tests/dwfl-report-offline-memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dwfl-report-offline-memory.c')
-rw-r--r--tests/dwfl-report-offline-memory.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/dwfl-report-offline-memory.c b/tests/dwfl-report-offline-memory.c
index 837aca5e..81fa136f 100644
--- a/tests/dwfl-report-offline-memory.c
+++ b/tests/dwfl-report-offline-memory.c
@@ -62,10 +62,14 @@ main (int argc, char **argv)
int fd = open (fname, O_RDONLY);
if (fd < 0)
error (-1, 0, "can't open file %s: %s", fname, strerror (errno));
- size_t size = lseek (fd, 0, SEEK_END);
+ off_t size = lseek (fd, 0, SEEK_END);
+ if (size < 0)
+ error (-1, 0, "can't lseek file %s: %s", fname, strerror (errno));
lseek (fd, 0, SEEK_SET);
char *data = malloc (size);
- size_t bytes_read = read (fd, data, size);
+ if (data == NULL)
+ error (-1, 0, "can't malloc: %s", strerror (errno));
+ ssize_t bytes_read = read (fd, data, size);
assert (bytes_read == size);
close (fd);