Commit 3b31cb02 authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼
Browse files

fix printing of off_t type

parent 527daada
Pipeline #548711 canceled with stages
...@@ -73,14 +73,14 @@ int main(int argc, char **argv) { ...@@ -73,14 +73,14 @@ int main(int argc, char **argv) {
PRINT_ERROR; PRINT_ERROR;
printf("%s opened.\n", filename); printf("%s opened.\n", filename);
printf("Target offset is %#lx, page size is %lu\n", target, sysconf(_SC_PAGE_SIZE)); printf("Target offset is %#zx, page size is %lu\n", (size_t) target, sysconf(_SC_PAGE_SIZE));
fflush(stdout); fflush(stdout);
/* Map one page */ /* Map one page */
printf("mmap(%d, %lu, %#x, %#x, %d, %#lx)\n", 0, printf("mmap(%d, %lu, %#x, %#x, %d, %#zx)\n", 0,
MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED,
fd, target); fd, (size_t) target);
map_base = mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, target & ~MAP_MASK); map_base = mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, target & ~MAP_MASK);
...@@ -107,7 +107,7 @@ int main(int argc, char **argv) { ...@@ -107,7 +107,7 @@ int main(int argc, char **argv) {
exit(2); exit(2);
} }
printf("Value at offset %#lx (%p): %#x\n", target, virt_addr, read_result); printf("Value at offset %#zx (%p): %#x\n", (size_t) target, virt_addr, read_result);
fflush(stdout); fflush(stdout);
if (argc > 4) { if (argc > 4) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment