diff options
author | Wojtek Kosior <kwojtus@protonmail.com> | 2019-12-27 22:30:53 +0100 |
---|---|---|
committer | Wojtek Kosior <kwojtus@protonmail.com> | 2019-12-27 22:30:53 +0100 |
commit | 6c6156c87c08ec06ccaf44ce391a8e25dbf77ea6 (patch) | |
tree | a0a00db93507067e97fb805e9ebcf6236b25ca00 | |
parent | 2f037d0ced1f9a357063667530931566e53e743c (diff) | |
download | rpi-MMU-example-6c6156c87c08ec06ccaf44ce391a8e25dbf77ea6.tar.gz rpi-MMU-example-6c6156c87c08ec06ccaf44ce391a8e25dbf77ea6.zip |
make int values always 4-aligned in fs image
-rw-r--r-- | makefs.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -38,6 +38,10 @@ int main(int argc, char **argv) if (printf("%s", argv[i]) != name_size) errx(-1, "error writing to stdout"); + for (int j = 0; (j + (name_size & 0b11)) & 0b11; j++) + if (putchar('\0')) + errx(-1, "error writing to stdout"); + if (fwrite(&file_size, 4, 1, stdout) != 1) errx(-1, "error writing to stdout"); @@ -60,6 +64,10 @@ int main(int argc, char **argv) if (!WIFEXITED(wstatus) || WEXITSTATUS(wstatus)) exit(-1); } + + for (int j = 0; (j + (file_size & 0b11)) & 0b11; j++) + if (putchar('\0')) + errx(-1, "error writing to stdout"); } return 0; |