tar: Rename field to better match spec

This commit is contained in:
sin 2015-04-23 16:14:09 +01:00
parent 624bf64ac5
commit 74f680948e

10
tar.c
View File

@ -24,7 +24,7 @@ struct header {
char mtime[12]; char mtime[12];
char chksum[8]; char chksum[8];
char type; char type;
char link[100]; char linkname[100];
char magic[6]; char magic[6];
char version[2]; char version[2];
char uname[32]; char uname[32];
@ -186,9 +186,9 @@ archive(const char *path)
h->type = DIRECTORY; h->type = DIRECTORY;
} else if (S_ISLNK(st.st_mode)) { } else if (S_ISLNK(st.st_mode)) {
h->type = SYMLINK; h->type = SYMLINK;
if ((r = readlink(path, h->link, sizeof(h->link) - 1)) < 0) if ((r = readlink(path, h->linkname, sizeof(h->linkname) - 1)) < 0)
eprintf("readlink %s:", path); eprintf("readlink %s:", path);
h->link[r] = '\0'; h->linkname[r] = '\0';
} else if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode)) { } else if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode)) {
h->type = S_ISCHR(st.st_mode) ? CHARDEV : BLOCKDEV; h->type = S_ISCHR(st.st_mode) ? CHARDEV : BLOCKDEV;
putoctal(h->major, (unsigned)major(st.st_dev), sizeof(h->major)); putoctal(h->major, (unsigned)major(st.st_dev), sizeof(h->major));
@ -245,8 +245,8 @@ unarchive(char *fname, ssize_t l, char b[BLKSIZ])
break; break;
case HARDLINK: case HARDLINK:
case SYMLINK: case SYMLINK:
snprintf(lname, sizeof(lname), "%.*s", (int)sizeof(h->link), snprintf(lname, sizeof(lname), "%.*s", (int)sizeof(h->linkname),
h->link); h->linkname);
if (((h->type == HARDLINK) ? link : symlink)(lname, fname) < 0) if (((h->type == HARDLINK) ? link : symlink)(lname, fname) < 0)
eprintf("%s %s -> %s:", eprintf("%s %s -> %s:",
(h->type == HARDLINK) ? "link" : "symlink", (h->type == HARDLINK) ? "link" : "symlink",