]> git.saurik.com Git - apple/file_cmds.git/commitdiff
file_cmds-185.2.tar.gz mac-os-x-1053 mac-os-x-1054 mac-os-x-1055 v185.2
authorApple <opensource@apple.com>
Sat, 19 Apr 2008 00:15:36 +0000 (00:15 +0000)
committerApple <opensource@apple.com>
Sat, 19 Apr 2008 00:15:36 +0000 (00:15 +0000)
Makefile
cp/Makefile
df/Makefile
install/xinstall.c
ipcs/Makefile
ls/print.c
pax/pax_format.c

index 30a7cc94b2f4d0202efa24dff87cd8b76aac4896..4b7ee0b4a0a39fb54c95ad45456dcaeb7109c050 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -11,9 +11,13 @@ NAME = file_cmds
 
 PROJECTVERSION = 2.8
 PROJECT_TYPE = Aggregate
+ifneq ($(shell tconf --test TARGET_OS_EMBEDDED),YES)
+#libcrypto missing
+MTREE=mtree
+endif
 
 TOOLS = chflags chmod chown cksum compress cp dd df du install ipcrm ipcs ln ls\
-        mkdir mkfifo mknod mtree mv pathchk pax rm rmdir rmt shar stat\
+        mkdir mkfifo mknod $(MTREE) mv pathchk pax rm rmdir rmt shar stat\
         touch
 
 OTHERSRCS = PROJECT Makefile.preamble Makefile Makefile.postamble
@@ -25,9 +29,12 @@ LIBS =
 DEBUG_LIBS = $(LIBS)
 PROF_LIBS = $(LIBS)
 
-
-NEXTSTEP_PB_CFLAGS = -mdynamic-no-pic -no-cpp-precomp -I/System/Library/Frameworks/System.framework/PrivateHeaders
-
+OTHER_LDFLAGS += -dead_strip
+NEXTSTEP_PB_CFLAGS = -mdynamic-no-pic -no-cpp-precomp -I "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders" -include TargetConditionals.h
+ifneq ($(SDKROOT),)
+OTHER_CFLAGS  += -isysroot "$(SDKROOT)"
+OTHER_LDFLAGS += -Wl,-syslibroot,"$(SDKROOT)"
+endif
 
 NEXTSTEP_BUILD_OUTPUT_DIR = /tmp/$(NAME)/Build
 
index 774bbfd19e1d9b0bea408091faf67223c6419a10..aba3cc8664905f489d67bd19135ca87aefa032c0 100644 (file)
@@ -51,5 +51,3 @@ include $(MAKEFILEDIR)/$(MAKEFILE)
 
 -include Makefile.dependencies
 
-ALL_CFLAGS += -I/System/Library/Frameworks/System.framework/PrivateHeaders
-
index 5156e6f207eafcf3a042b0fbfde66d09dcd55c1a..36d8c06323388d80c3a059f248bc7a36696fbce4 100644 (file)
@@ -47,4 +47,4 @@ include $(MAKEFILEDIR)/$(MAKEFILE)
 
 -include Makefile.dependencies
 
-ALL_CFLAGS += -I/System/Library/Frameworks/System.framework/PrivateHeaders -D_DARWIN_USE_64_BIT_INODE
+ALL_CFLAGS += -I "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders" -D_DARWIN_USE_64_BIT_INODE
index d5b41a12d97ae6739aab3f17186a5528eb8080f2..e6d732f8d004e212cb9ecbccb73b6c4ac436bfac 100644 (file)
@@ -526,7 +526,11 @@ install(from_name, to_name, fset, flags)
        if (!devnull)
                (void)close(from_fd);
 }
-
+#if TARGET_OS_EMBEDDED
+#define BUFFER_SIZE 128*1024
+#else  /* !TARGET_OS_EMBEDDED */
+#define BUFFER_SIZE MAXBSIZE
+#endif /* TARGET_OS_EMBEDDED */
 /*
  * compare --
  *     compare two files; non-zero means files differ
@@ -562,8 +566,8 @@ compare(int from_fd, const char *from_name, size_t from_len,
                }
        out:
                if (!done_compare) {
-                       char buf1[MAXBSIZE];
-                       char buf2[MAXBSIZE];
+                       char buf1[BUFFER_SIZE];
+                       char buf2[BUFFER_SIZE];
                        int n1, n2;
 
                        rv = 0;
@@ -666,7 +670,7 @@ copy(from_fd, from_name, to_fd, to_name, size)
 {
        register int nr, nw;
        int serrno;
-       char *p, buf[MAXBSIZE];
+       char *p, buf[BUFFER_SIZE];
        int done_copy;
 
        /* Rewind file descriptors. */
index ea77822b79512f5117e3bd8cea9cf97f707a59fd..f2ac495ab4f3e36672fd71a4770085f5714e832a 100644 (file)
@@ -24,7 +24,7 @@ LIBS =
 DEBUG_LIBS = $(LIBS)
 PROF_LIBS = $(LIBS)
 
-NEXTSTEP_PB_CFLAGS = -iquote /System/Library/Frameworks/System.framework/PrivateHeaders -iquote /System/Library/Frameworks/Kernel.framework/PrivateHeaders
+NEXTSTEP_PB_CFLAGS = -iquote "$(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders" -iquote "$(SDKROOT)/System/Library/Frameworks/Kernel.framework/PrivateHeaders"
 NEXTSTEP_BUILD_OUTPUT_DIR = /tmp/$(NAME)/Build
 
 NEXTSTEP_OBJCPLUS_COMPILER = /usr/bin/cc
index 02b1211afa3daff5bc1b051f6625bf45fbc0fae1..5f222cdfff045f48f9e7c54396520c511a8575d3 100644 (file)
@@ -50,8 +50,10 @@ __RCSID("$FreeBSD: src/bin/ls/print.c,v 1.57 2002/08/29 14:29:09 keramida Exp $"
 #include <sys/types.h>
 #include <grp.h>
 #include <pwd.h>
+#if !TARGET_OS_EMBEDDED
 #include <membership.h>
 #include <membershipPriv.h>
+#endif
 #include <uuid/uuid.h>
 #endif
 
@@ -197,6 +199,9 @@ static struct {
 static char *
 uuid_to_name(uuid_t *uu) 
 {
+#if TARGET_OS_EMBEDDED
+  return strdup("<UNKNOWN>");
+#else  /* !TARGET_OS_EMBEDDED */
   int is_gid = -1;
   struct group *tgrp = NULL;
   struct passwd *tpass = NULL;
@@ -240,6 +245,7 @@ uuid_to_name(uuid_t *uu)
                strcpy(name, "<UNKNOWN>");
        }
   return name;
+#endif /* !TARGET_OS_EMBEDDED */
 }
 
 static void
@@ -289,7 +295,6 @@ printacl(acl_t acl, int isdir)
                        continue;
                if (acl_get_permset(entry, &perms) != 0)
                        continue;
-
                name = uuid_to_name(applicable);
                acl_free(applicable);
 
index e98d8a75a2be8d97d72848432ba24a7a71d1cb76..af2d8abd5ec5a3feec5bf68aa2c7262b5e8fed84 100644 (file)
@@ -1075,12 +1075,15 @@ expand_extended_headers(ARCHD *arcn, HD_USTAR *hd)
                char *name, *str;
                int size, nbytes, inx;
                size = asc_ul(myhd->size, sizeof(myhd->size), OCT);
-               if (size > sizeof(mybuf))
+               if (size > sizeof(mybuf)) {
                        paxwarn(1,"extended header buffer overflow");
+                       exit(1);
+               }
                nbytes = rd_wrbuf(mybuf, size);
                if (nbytes != size) {
                        paxwarn(1,"extended header data read failure: nbytes=%d, size=%d\n",
                                nbytes, size);
+                       exit(1);
                }
                /*
                printf("Read 1 extended header: type=%c, size=%d\n",
@@ -1093,19 +1096,30 @@ expand_extended_headers(ARCHD *arcn, HD_USTAR *hd)
                        int nentries = sscanf(&mybuf[inx],"%d ", &len);
                        if (nentries != 1) {
                                paxwarn(1,"Extended header failure: length");
+                               exit(1);
+                       }
+                       if (len < 0 || (inx+len-1 >= sizeof(mybuf))) {
+                               paxwarn(1, "Extended header failure: invalid length (%d)", len);
+                               exit(1);
                        }
-                       if (mybuf[inx+len-1] != '\n')
+                       if (mybuf[inx+len-1] != '\n') {
                                paxwarn(1,"Extended header failure: missed newline");
-                       else mybuf[inx+len-1] = '\0';
+                               exit(1);
+                       } else
+                               mybuf[inx+len-1] = '\0';
                        name = strchr(&mybuf[inx],' ');
                        if (name) name++;
-                       else 
+                       else {
                                paxwarn(1,"Extended header failure: missing space");
+                               exit(1);
+                       }
                        str = strchr(name,'=');
                        if (str) {
                                *str++='\0'; /* end of name */
-                       } else
+                       } else {
                                paxwarn(1,"Extended header failure: missing RHS string");
+                               exit(1);
+                       }
                        for (i = 0; i < sizeof(o_option_table)/sizeof(O_OPTION_TYPE); i++) {
                                if (strncasecmp(name, o_option_table[i].name, o_option_table[i].len) == 0) {
                                        /* Found option: see if already set TBD */