commit c83aef2cda7bce8db7cd266576a2edd9d11b9388
parent 203b52c38a447e6e1cadcab4cd366cd5bd86be94
Author: sin <sin@2f30.org>
Date: Tue, 28 Jan 2014 16:54:41 +0000
Use preprocessor conditionals to check if makedev() is present
makedev() is not portable and is typically implemented as a
macro. If it exists use it, otherwise silently ignore character
and block devices.
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/tar.c b/tar.c
@@ -245,12 +245,14 @@ unarchive(char *fname, int l, char b[Blksiz])
break;
case CHARDEV:
case BLOCKDEV:
+#ifdef makedev
mode = strtoul(h->mode, 0, 8);
major = strtoul(h->major, 0, 8);
minor = strtoul(h->mode, 0, 8);
type = (h->type == CHARDEV) ? S_IFCHR : S_IFBLK;
if(mknod(fname, type | mode, makedev(major, minor)))
perror(fname);
+#endif
break;
case FIFO:
mode = strtoul(h->mode, 0, 8);