Only use major()/minor() if they are available in tar(1)
Otherwise silently ignore them in the archive case. This is the same in principle as what we do in the unarchive case.
This commit is contained in:
parent
0a7791a25c
commit
e37e2782a9
4
tar.c
4
tar.c
@ -193,8 +193,12 @@ archive(const char* path)
|
|||||||
readlink(path, h->link, (sizeof h->link)-1);
|
readlink(path, h->link, (sizeof h->link)-1);
|
||||||
} else if(S_ISCHR(mode) || S_ISBLK(mode)) {
|
} else if(S_ISCHR(mode) || S_ISBLK(mode)) {
|
||||||
h->type = S_ISCHR(mode) ? CHARDEV : BLOCKDEV;
|
h->type = S_ISCHR(mode) ? CHARDEV : BLOCKDEV;
|
||||||
|
#if defined(major) && defined(minor)
|
||||||
putoctal(h->major, (unsigned)major(st.st_dev), sizeof h->major);
|
putoctal(h->major, (unsigned)major(st.st_dev), sizeof h->major);
|
||||||
putoctal(h->minor, (unsigned)minor(st.st_dev), sizeof h->minor);
|
putoctal(h->minor, (unsigned)minor(st.st_dev), sizeof h->minor);
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
} else if(S_ISFIFO(mode)) {
|
} else if(S_ISFIFO(mode)) {
|
||||||
h->type = FIFO;
|
h->type = FIFO;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user