Workaround missing lchmod/lchown
Change-Id: I231a0010722619d389b763af35ff55f84ca9cb76
This commit is contained in:
parent
5b851f3a9c
commit
18f97ad415
8 changed files with 14 additions and 10 deletions
|
@ -53,7 +53,6 @@ DPADD+= ${LIBRMT}
|
||||||
|
|
||||||
.if defined(__MINIX)
|
.if defined(__MINIX)
|
||||||
CPPFLAGS+= -DHOSTPROG
|
CPPFLAGS+= -DHOSTPROG
|
||||||
CPPFLAGS+= -Dlchown=chown -Dlchmod=chmod
|
|
||||||
|
|
||||||
MLINKS+= pax.1 bsdtar.1
|
MLINKS+= pax.1 bsdtar.1
|
||||||
.endif # defined(__MINIX)
|
.endif # defined(__MINIX)
|
||||||
|
|
|
@ -259,12 +259,12 @@ __pure int
|
||||||
getpagesize(void); /* legacy */
|
getpagesize(void); /* legacy */
|
||||||
#if !defined(__minix)
|
#if !defined(__minix)
|
||||||
pid_t getpgid(pid_t);
|
pid_t getpgid(pid_t);
|
||||||
|
#endif /* !defined(__minix) */
|
||||||
#if defined(_XOPEN_SOURCE)
|
#if defined(_XOPEN_SOURCE)
|
||||||
int lchown(const char *, uid_t, gid_t) __RENAME(__posix_lchown);
|
int lchown(const char *, uid_t, gid_t) __RENAME(__posix_lchown);
|
||||||
#else
|
#else
|
||||||
int lchown(const char *, uid_t, gid_t);
|
int lchown(const char *, uid_t, gid_t);
|
||||||
#endif
|
#endif
|
||||||
#endif /* !defined(__minix) */
|
|
||||||
int lockf(int, int, off_t);
|
int lockf(int, int, off_t);
|
||||||
#if __SSP_FORTIFY_LEVEL == 0
|
#if __SSP_FORTIFY_LEVEL == 0
|
||||||
ssize_t readlink(const char * __restrict, char * __restrict, size_t);
|
ssize_t readlink(const char * __restrict, char * __restrict, size_t);
|
||||||
|
|
|
@ -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.
|
# Minix specific syscalls / utils.
|
||||||
SRCS+= cprofile.c sprofile.c stack_utils.c _mcontext.c
|
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"
|
.include "${ARCHDIR}/sys-minix/Makefile.inc"
|
||||||
|
|
|
@ -22,7 +22,6 @@ LINTFLAGS+=-S -w
|
||||||
SRCS+= inode.c link.c misc.c mount.c open.c path.c path_puffs.c \
|
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
|
protect.c read.c stadir.c time.c utility.c table.c
|
||||||
|
|
||||||
CPFFLAGS+=-Dlchown=chown -Dlchmod=chmod
|
|
||||||
CPPFLAGS+= -D_MINIX_SYSTEM
|
CPPFLAGS+= -D_MINIX_SYSTEM
|
||||||
|
|
||||||
NOGCCERROR=yes
|
NOGCCERROR=yes
|
||||||
|
|
|
@ -32,7 +32,9 @@
|
||||||
/* Emulate lchmod(2), checking path with lstat(2) first to ensure that
|
/* Emulate lchmod(2), checking path with lstat(2) first to ensure that
|
||||||
* it's not a symlink, and then call chmod(2) */
|
* it's not a symlink, and then call chmod(2) */
|
||||||
|
|
||||||
|
#if !defined(__minix) && !defined(_LIBC)
|
||||||
#include "nbtool_config.h"
|
#include "nbtool_config.h"
|
||||||
|
#endif /* !defined(__minix) && !defined(_LIBC) */
|
||||||
|
|
||||||
#if !HAVE_LCHMOD
|
#if !HAVE_LCHMOD
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
|
@ -32,13 +32,19 @@
|
||||||
/* Emulate lchown(2), checking path with lstat(2) first to ensure that
|
/* Emulate lchown(2), checking path with lstat(2) first to ensure that
|
||||||
* it's not a symlink, and then call chown(2) */
|
* it's not a symlink, and then call chown(2) */
|
||||||
|
|
||||||
|
#if !defined(__minix) && !defined(_LIBC)
|
||||||
#include "nbtool_config.h"
|
#include "nbtool_config.h"
|
||||||
|
#endif /* !defined(__minix) && !defined(_LIBC) */
|
||||||
|
|
||||||
#if !HAVE_LCHOWN
|
#if !HAVE_LCHOWN
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.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
|
int
|
||||||
lchown(const char *path, uid_t owner, gid_t group)
|
lchown(const char *path, uid_t owner, gid_t group)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,8 +8,4 @@ SRCS+= radix_sort.c
|
||||||
LDADD+=-lutil
|
LDADD+=-lutil
|
||||||
DPADD+=${LIBUTIL}
|
DPADD+=${LIBUTIL}
|
||||||
|
|
||||||
.if defined(__MINIX)
|
|
||||||
CPPFLAGS+= -Dlchown=chown -Dlchmod=chmod
|
|
||||||
.endif # defined(__MINIX)
|
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
|
|
@ -10,9 +10,6 @@ MAN= mtree.8
|
||||||
SRCS= compare.c crc.c create.c excludes.c misc.c mtree.c spec.c specspec.c \
|
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
|
verify.c getid.c pack_dev.c only.c
|
||||||
.if (${HOSTPROG:U} == "")
|
.if (${HOSTPROG:U} == "")
|
||||||
.if defined(__MINIX)
|
|
||||||
CPPFLAGS+= -Dlchown=chown -Dlchmod=chmod
|
|
||||||
.endif
|
|
||||||
DPADD+= ${LIBUTIL}
|
DPADD+= ${LIBUTIL}
|
||||||
LDADD+= -lutil
|
LDADD+= -lutil
|
||||||
.endif
|
.endif
|
||||||
|
|
Loading…
Reference in a new issue