Workaround missing lchmod/lchown

Change-Id: I231a0010722619d389b763af35ff55f84ca9cb76
This commit is contained in:
Lionel Sambuc 2014-03-15 14:11:22 +01:00
parent 5b851f3a9c
commit 18f97ad415
8 changed files with 14 additions and 10 deletions

View file

@ -53,7 +53,6 @@ DPADD+= ${LIBRMT}
.if defined(__MINIX)
CPPFLAGS+= -DHOSTPROG
CPPFLAGS+= -Dlchown=chown -Dlchmod=chmod
MLINKS+= pax.1 bsdtar.1
.endif # defined(__MINIX)

View file

@ -259,12 +259,12 @@ __pure int
getpagesize(void); /* legacy */
#if !defined(__minix)
pid_t getpgid(pid_t);
#endif /* !defined(__minix) */
#if defined(_XOPEN_SOURCE)
int lchown(const char *, uid_t, gid_t) __RENAME(__posix_lchown);
#else
int lchown(const char *, uid_t, gid_t);
#endif
#endif /* !defined(__minix) */
int lockf(int, int, off_t);
#if __SSP_FORTIFY_LEVEL == 0
ssize_t readlink(const char * __restrict, char * __restrict, size_t);

View file

@ -27,4 +27,9 @@ SRCS+= accept.c access.c adjtime.c bind.c brk.c sbrk.c m_closefrom.c getsid.c \
# Minix specific syscalls / utils.
SRCS+= cprofile.c sprofile.c stack_utils.c _mcontext.c
# Emulation for missing lchown/lchmod
OBJS+= lchown.o lchmod.o
lchown.o lchown.pico lchown.bc: ${NETBSDSRCDIR}/tools/compat/lchown.c
lchmod.o lchmod.pico lchmod.bc: ${NETBSDSRCDIR}/tools/compat/lchmod.c
.include "${ARCHDIR}/sys-minix/Makefile.inc"

View file

@ -22,7 +22,6 @@ LINTFLAGS+=-S -w
SRCS+= inode.c link.c misc.c mount.c open.c path.c path_puffs.c \
protect.c read.c stadir.c time.c utility.c table.c
CPFFLAGS+=-Dlchown=chown -Dlchmod=chmod
CPPFLAGS+= -D_MINIX_SYSTEM
NOGCCERROR=yes

View file

@ -32,7 +32,9 @@
/* Emulate lchmod(2), checking path with lstat(2) first to ensure that
* it's not a symlink, and then call chmod(2) */
#if !defined(__minix) && !defined(_LIBC)
#include "nbtool_config.h"
#endif /* !defined(__minix) && !defined(_LIBC) */
#if !HAVE_LCHMOD
#include <sys/stat.h>

View file

@ -32,13 +32,19 @@
/* Emulate lchown(2), checking path with lstat(2) first to ensure that
* it's not a symlink, and then call chown(2) */
#if !defined(__minix) && !defined(_LIBC)
#include "nbtool_config.h"
#endif /* !defined(__minix) && !defined(_LIBC) */
#if !HAVE_LCHOWN
#include <sys/stat.h>
#include <errno.h>
#include <unistd.h>
#if defined(__minix) && defined(__weak_alias) && defined(_LIBC)
__weak_alias(__posix_lchown, lchown)
#endif /* defined(__minix) && defined(__weak_alias) && defined(_LIBC) */
int
lchown(const char *path, uid_t owner, gid_t group)
{

View file

@ -8,8 +8,4 @@ SRCS+= radix_sort.c
LDADD+=-lutil
DPADD+=${LIBUTIL}
.if defined(__MINIX)
CPPFLAGS+= -Dlchown=chown -Dlchmod=chmod
.endif # defined(__MINIX)
.include <bsd.prog.mk>

View file

@ -10,9 +10,6 @@ MAN= mtree.8
SRCS= compare.c crc.c create.c excludes.c misc.c mtree.c spec.c specspec.c \
verify.c getid.c pack_dev.c only.c
.if (${HOSTPROG:U} == "")
.if defined(__MINIX)
CPPFLAGS+= -Dlchown=chown -Dlchmod=chmod
.endif
DPADD+= ${LIBUTIL}
LDADD+= -lutil
.endif