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
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
-include Makefile.dependencies
-ALL_CFLAGS += -I/System/Library/Frameworks/System.framework/PrivateHeaders
-
-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
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
}
out:
if (!done_compare) {
- char buf1[MAXBSIZE];
- char buf2[MAXBSIZE];
+ char buf1[BUFFER_SIZE];
+ char buf2[BUFFER_SIZE];
int n1, n2;
rv = 0;
{
register int nr, nw;
int serrno;
- char *p, buf[MAXBSIZE];
+ char *p, buf[BUFFER_SIZE];
int done_copy;
/* Rewind file descriptors. */
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
#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
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;
strcpy(name, "<UNKNOWN>");
}
return name;
+#endif /* !TARGET_OS_EMBEDDED */
}
static void
continue;
if (acl_get_permset(entry, &perms) != 0)
continue;
-
name = uuid_to_name(applicable);
acl_free(applicable);
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",
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 */