[hackers] [sbase] Use preprocessor conditionals to check if makedev() is present || sin

From: <git_AT_suckless.org>
Date: Wed, 29 Jan 2014 14:44:11 +0100

commit c83aef2cda7bce8db7cd266576a2edd9d11b9388
Author: sin <sin_AT_2f30.org>
Date: Tue Jan 28 16:54:41 2014 +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.

diff --git a/tar.c b/tar.c
index 4585d95..a478e5f 100644
--- a/tar.c
+++ b/tar.c
_AT_@ -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);
Received on Wed Jan 29 2014 - 14:44:11 CET

This archive was generated by hypermail 2.3.0 : Wed Jan 29 2014 - 14:48:20 CET