[hackers] [sbase] Only use major()/minor() if they are available in tar(1) || sin

From: <git_AT_suckless.org>
Date: Thu, 30 Jan 2014 17:19:06 +0100

commit e37e2782a93af0bc08e09e4785e031c35dc413cb
Author: sin <sin_AT_2f30.org>
Date: Thu Jan 30 16:14:33 2014 +0000

    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.

diff --git a/tar.c b/tar.c
index 1ecf8bd..e98f620 100644
--- a/tar.c
+++ b/tar.c
_AT_@ -193,8 +193,12 @@ archive(const char* path)
                 readlink(path, h->link, (sizeof h->link)-1);
         } else if(S_ISCHR(mode) || S_ISBLK(mode)) {
                 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->minor, (unsigned)minor(st.st_dev), sizeof h->minor);
+#else
+ return 0;
+#endif
         } else if(S_ISFIFO(mode)) {
                 h->type = FIFO;
         }
Received on Thu Jan 30 2014 - 17:19:06 CET

This archive was generated by hypermail 2.3.0 : Thu Jan 30 2014 - 17:24:13 CET