Forgot to initialize ObjId structure in newfs

This commit is contained in:
Ali Mashtizadeh 2023-09-10 20:56:37 -04:00
parent b39acb2afd
commit fc665b5f5b

View File

@ -112,6 +112,7 @@ ObjID *AddFile(const char *file)
ObjID *id = malloc(sizeof(ObjID));
BNode node;
memset(id, 0, sizeof(*id));
memset(&node, 0, sizeof(node));
memcpy(node.magic, BNODE_MAGIC, 8);
node.versionMajor = O2FS_VERSION_MAJOR;
@ -209,6 +210,7 @@ ObjID *AddDirectory()
int i;
uint64_t off;
memset(id, 0, sizeof(*id));
memset(&node, 0, sizeof(node));
memcpy(node.magic, BNODE_MAGIC, 8);
node.versionMajor = O2FS_VERSION_MAJOR;
@ -262,6 +264,9 @@ int main(int argc, char * const *argv)
int ch;
int status;
// Sanity check
assert(sizeof(BDirEntry) == 512);
struct option longopts[] = {
{ "manifest", required_argument, NULL, 'm' },
{ "size", required_argument, NULL, 's' },