aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojtek Kosior <kwojtus@protonmail.com>2019-12-28 12:37:47 +0100
committerWojtek Kosior <kwojtus@protonmail.com>2019-12-28 12:37:47 +0100
commit311ddd85042170f35736b9491ce952ee51e21db1 (patch)
tree76055c27c6421d39a3229ad981b8e9a0e729fabb
parent8b80b2a919012560b72405e3e34993b8ad35b82c (diff)
downloadrpi-MMU-example-311ddd85042170f35736b9491ce952ee51e21db1.tar.gz
rpi-MMU-example-311ddd85042170f35736b9491ce952ee51e21db1.zip
another hopefully last change to the format - add terminating null-byte at the end of the entire ramfs
-rw-r--r--makefs.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/makefs.c b/makefs.c
index 90e731c..379e8c5 100644
--- a/makefs.c
+++ b/makefs.c
@@ -5,7 +5,9 @@
// 4-byte little-endian size of the file and then the contents
// of the file and then another null-padding until a 4-aligned offset.
// Files encoded this way go one after another (so it's easy to add
-// something at the end or at the beginning).
+// something at the beginning).
+// At the and comes one null-byte (as if a file with empty name
+// was there).
#include <stdint.h>
#include <sys/types.h>
@@ -87,6 +89,9 @@ int main(int argc, char **argv)
errx(-1, "error writing to stdout");
}
+ if (putchar('\0'))
+ errx(-1, "error writing to stdout");
+
return 0;
}