aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--omar.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/omar.c b/omar.c
index 3244415..39421b7 100644
--- a/omar.c
+++ b/omar.c
@@ -105,6 +105,10 @@ file_push(const char *pathname, const char *name)
}
}
+ /* Set the lengths */
+ hdr.len = (pathname == NULL) ? 0 : sb.st_size;
+ hdr.namelen = strlen(name);
+
/*
* The next pointer being 0 indicates that we
* have reached the end of the archive. If we
@@ -113,11 +117,10 @@ file_push(const char *pathname, const char *name)
*/
if (pathname != NULL) {
hdr.nextptr = sizeof(hdr) + ALIGN_UP(hdr.len, BLOCK_SIZE);
+ printf("NEXT POINTER: %d\n", hdr.nextptr);
} else {
hdr.nextptr = 0;
}
- hdr.len = (pathname == NULL) ? 0 : sb.st_size;
- hdr.namelen = strlen(name);
memcpy(hdr.magic, "OMAR", sizeof(hdr.magic));
write(outfd, &hdr, sizeof(hdr));
write(outfd, name, hdr.namelen);