memcpy(&header[257], "ustar", 6);
memcpy(&header[263], "00", 2);
- printf(&header[329], "%07o", 0); /* devmajor */
- printf(&header[337], "%07o", 0); /* devminor */
+ sprintf(&header[329], "%07o", 0); /* devmajor */
+ sprintf(&header[337], "%07o", 0); /* devminor */
memset(&header[148], ' ', 8);
for (i = 0; i < RECORDSIZE; i++)
if (size < namelen + 20 || sscanf(buffer, "%o", &mode) != 1)
die("corrupt 'tree' file");
+ if (S_ISDIR(mode) || S_ISREG(mode))
+ mode |= (mode & 0100) ? 0777 : 0666;
buffer = sha1 + 20;
size -= namelen + 20;