From b1857959f57db441de22908c2c6c28baac8cd28a Mon Sep 17 00:00:00 2001 From: Apple Date: Sat, 19 Apr 2008 00:15:36 +0000 Subject: [PATCH] file_cmds-185.2.tar.gz --- Makefile | 15 +++++++++++---- cp/Makefile | 2 -- df/Makefile | 2 +- install/xinstall.c | 12 ++++++++---- ipcs/Makefile | 2 +- ls/print.c | 7 ++++++- pax/pax_format.c | 24 +++++++++++++++++++----- 7 files changed, 46 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 30a7cc9..4b7ee0b 100644 --- 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 diff --git a/cp/Makefile b/cp/Makefile index 774bbfd..aba3cc8 100644 --- a/cp/Makefile +++ b/cp/Makefile @@ -51,5 +51,3 @@ include $(MAKEFILEDIR)/$(MAKEFILE) -include Makefile.dependencies -ALL_CFLAGS += -I/System/Library/Frameworks/System.framework/PrivateHeaders - diff --git a/df/Makefile b/df/Makefile index 5156e6f..36d8c06 100644 --- a/df/Makefile +++ b/df/Makefile @@ -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 diff --git a/install/xinstall.c b/install/xinstall.c index d5b41a1..e6d732f 100644 --- a/install/xinstall.c +++ b/install/xinstall.c @@ -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. */ diff --git a/ipcs/Makefile b/ipcs/Makefile index ea77822..f2ac495 100644 --- a/ipcs/Makefile +++ b/ipcs/Makefile @@ -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 diff --git a/ls/print.c b/ls/print.c index 02b1211..5f222cd 100644 --- a/ls/print.c +++ b/ls/print.c @@ -50,8 +50,10 @@ __RCSID("$FreeBSD: src/bin/ls/print.c,v 1.57 2002/08/29 14:29:09 keramida Exp $" #include #include #include +#if !TARGET_OS_EMBEDDED #include #include +#endif #include #endif @@ -197,6 +199,9 @@ static struct { static char * uuid_to_name(uuid_t *uu) { +#if TARGET_OS_EMBEDDED + return strdup(""); +#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, ""); } 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); diff --git a/pax/pax_format.c b/pax/pax_format.c index e98d8a7..af2d8ab 100644 --- a/pax/pax_format.c +++ b/pax/pax_format.c @@ -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 */ -- 2.7.4