Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC)
- Fix for possible unset uid/gid in toproto
- Fix for default mtree style
- Update libelf
- Importing libexecinfo
- Resynchronize GCC, mpc, gmp, mpfr
- build.sh: Replace params with show-params.
This has been done as the make target has been renamed in the same
way, while a new target named params has been added. This new
target generates a file containing all the parameters, instead of
printing it on the console.
- Update test48 with new etc/services (Fix by Ben Gras <ben@minix3.org)
get getservbyport() out of the inner loop
Change-Id: Ie6ad5226fa2621ff9f0dee8782ea48f9443d2091
This commit is contained in:
@@ -1,29 +1,46 @@
|
||||
# $NetBSD: Makefile,v 1.266 2012/08/08 14:13:46 christos Exp $
|
||||
# $NetBSD: Makefile,v 1.268 2013/11/28 22:34:44 christos Exp $
|
||||
# from: @(#)Makefile 5.20 (Berkeley) 6/12/93
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
SUBDIR= \
|
||||
\
|
||||
chroot \
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
i2cscan installboot \
|
||||
\
|
||||
\
|
||||
link \
|
||||
\
|
||||
mtree \
|
||||
\
|
||||
\
|
||||
pwd_mkdb postinstall \
|
||||
\
|
||||
\
|
||||
rdate \
|
||||
\
|
||||
\
|
||||
\
|
||||
\
|
||||
unlink user \
|
||||
vipw \
|
||||
vnconfig \
|
||||
vipw vnconfig \
|
||||
\
|
||||
zic
|
||||
|
||||
.if defined(__MINIX)
|
||||
# LSC MINIX Specific
|
||||
SUBDIR+= mkfs.mfs \
|
||||
mkproto
|
||||
|
||||
.if !defined(__MINIX)
|
||||
.else
|
||||
.if ${MKMAKEMANDB} != "no"
|
||||
SUBDIR+= makemandb
|
||||
.endif
|
||||
.endif # !defined(__MINIX)
|
||||
.endif # defined(__MINIX)
|
||||
|
||||
.if (${MKYP} != "no")
|
||||
SUBDIR+= rpc.yppasswdd ypbind yppoll ypserv ypset
|
||||
|
||||
@@ -3,7 +3,3 @@
|
||||
|
||||
BINDIR?= /usr/sbin
|
||||
WARNS?= 4
|
||||
|
||||
# BJG too many warnings here
|
||||
NOGCCERROR?= yes
|
||||
NOCLANGERROR?= yes
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.46 2011/08/14 17:50:16 christos Exp $
|
||||
# $NetBSD: Makefile,v 1.47 2012/08/10 12:10:28 joerg Exp $
|
||||
#
|
||||
|
||||
.include <bsd.own.mk>
|
||||
@@ -8,15 +8,21 @@ MAN= installboot_nbsd.8
|
||||
SRCS= installboot.c sum.c machines.c fstypes.c install_master.c
|
||||
|
||||
|
||||
.if !defined(__MINIX)
|
||||
ARCH_XLAT= amd64-i386.c news68k-news.c newsmips-news.c
|
||||
ARCH_XLAT+= sun2-sun68k.c sun3-sun68k.c
|
||||
.else
|
||||
ARCH_XLAT= amd64-i386.c
|
||||
#ARCH_XLAT= amd64-i386.c news68k-news.c newsmips-news.c
|
||||
#ARCH_XLAT+= sun2-sun68k.c sun3-sun68k.c
|
||||
.endif # !defined(__MINIX)
|
||||
|
||||
.if !defined(SMALLPROG) && !defined(ARCH_FILES)
|
||||
.if !defined(__MINIX)
|
||||
ARCH_FILES= alpha.c amiga.c emips.c ews4800mips.c hp300.c hp700.c i386.c
|
||||
ARCH_FILES+= landisk.c macppc.c news.c next68k.c pmax.c
|
||||
ARCH_FILES+= sparc.c sparc64.c sun68k.c vax.c x68k.c
|
||||
.else
|
||||
ARCH_FILES= i386.c
|
||||
#ARCH_FILES= alpha.c amiga.c emips.c ews4800mips.c hp300.c hp700.c i386.c
|
||||
#ARCH_FILES+= landisk.c macppc.c news.c next68k.c pmax.c
|
||||
#ARCH_FILES+= sparc.c sparc64.c sun68k.c vax.c x68k.c
|
||||
.endif # !defined(__MINIX)
|
||||
.else
|
||||
ARCH_FILES?= ${ARCH_XLAT:M${MACHINE}-*:S/${MACHINE}-//}
|
||||
.if empty(ARCH_FILES)
|
||||
@@ -26,35 +32,36 @@ ARCH_FILES= ${MACHINE}.c
|
||||
|
||||
SRCS+=${ARCH_FILES}
|
||||
|
||||
.if !defined(__MINIX)
|
||||
.if empty(ARCH_FILES:C/(macppc|news|sparc|sun68k|x68k)/stg2/:Mstg2.c)
|
||||
CPPFLAGS += -DNO_STAGE2
|
||||
#.if empty(ARCH_FILES:C/(macppc|news|sparc|sun68k|x68k)/stg2/:Mstg2.c)
|
||||
#CPPFLAGS += -DNO_STAGE2
|
||||
#.else
|
||||
#SRCS+= bbinfo.c
|
||||
.else
|
||||
SRCS+= bbinfo.c
|
||||
|
||||
# fstypes are only needed for 'stage2' and then only from bbinfo.
|
||||
#SRCS+= ffs.c
|
||||
#.if SMALLPROG
|
||||
#CPPFLAGS+= -DNO_FFS_SWAP
|
||||
#.else
|
||||
#SRCS+= ffs_bswap.c
|
||||
#.endif
|
||||
SRCS+= ffs.c
|
||||
.if SMALLPROG
|
||||
CPPFLAGS+= -DNO_FFS_SWAP
|
||||
.else
|
||||
SRCS+= ffs_bswap.c
|
||||
.endif
|
||||
#SRCS+= ext2fs.c ext2fs_bswap.c
|
||||
#.endif
|
||||
.endif
|
||||
|
||||
UFSSRC= ${NETBSDSRCDIR}/sys/ufs
|
||||
CPPFLAGS+= -I${.CURDIR} -I.
|
||||
.PATH: ${.CURDIR}/arch ${UFSSRC}/ffs ${UFSSRC}/ext2fs
|
||||
.else
|
||||
CPPFLAGS += -DNO_STAGE2
|
||||
SRCS+= minixfs3.c
|
||||
|
||||
#UFSSRC= ${NETBSDSRCDIR}/sys/ufs
|
||||
#.PATH: ${.CURDIR}/arch ${UFSSRC}/ffs ${UFSSRC}/ext2fs
|
||||
.PATH: ${.CURDIR}/arch
|
||||
CPPFLAGS+= -I${.CURDIR} -I.
|
||||
.endif # !defined(__MINIX)
|
||||
|
||||
.if !defined(HOSTPROGNAME)
|
||||
.if defined(HAVE_GCC) || defined(HAVE_PCC)
|
||||
.for f in i386 macppc
|
||||
COPTS.${f}.c+= -Wno-pointer-sign
|
||||
.endfor
|
||||
.endif
|
||||
.endif
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: amiga.c,v 1.7 2010/01/14 16:27:49 tsutsui Exp $ */
|
||||
/* $NetBSD: amiga.c,v 1.8 2013/06/14 03:54:43 msaitoh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2002 The NetBSD Foundation, Inc.
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if !defined(__lint)
|
||||
__RCSID("$NetBSD: amiga.c,v 1.7 2010/01/14 16:27:49 tsutsui Exp $");
|
||||
__RCSID("$NetBSD: amiga.c,v 1.8 2013/06/14 03:54:43 msaitoh Exp $");
|
||||
#endif /* !__lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -76,7 +76,7 @@ amiga_setboot(ib_params *params)
|
||||
char *dline;
|
||||
int sumlen;
|
||||
u_int32_t sum2, sum16;
|
||||
|
||||
|
||||
struct stat bootstrapsb;
|
||||
|
||||
u_int32_t block[128*16];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hp300.c,v 1.13 2011/02/10 23:25:11 tsutsui Exp $ */
|
||||
/* $NetBSD: hp300.c,v 1.15 2013/06/14 03:54:43 msaitoh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
@@ -35,14 +35,15 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if !defined(__lint)
|
||||
__RCSID("$NetBSD: hp300.c,v 1.13 2011/02/10 23:25:11 tsutsui Exp $");
|
||||
__RCSID("$NetBSD: hp300.c,v 1.15 2013/06/14 03:54:43 msaitoh Exp $");
|
||||
#endif /* !__lint */
|
||||
|
||||
/* We need the target disklabel.h, not the hosts one..... */
|
||||
#ifdef HAVE_NBTOOL_CONFIG_H
|
||||
#include "nbtool_config.h"
|
||||
#include <nbinclude/hp300/disklabel.h>
|
||||
#include <nbinclude/sys/disklabel.h>
|
||||
#else
|
||||
#else
|
||||
#include <sys/disklabel.h>
|
||||
#endif
|
||||
#include <sys/fcntl.h>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hp700.c,v 1.4 2008/04/28 20:24:16 martin Exp $ */
|
||||
/* $NetBSD: hp700.c,v 1.6 2013/06/14 03:54:43 msaitoh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@@ -35,14 +35,14 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if !defined(__lint)
|
||||
__RCSID("$NetBSD: hp700.c,v 1.4 2008/04/28 20:24:16 martin Exp $");
|
||||
__RCSID("$NetBSD: hp700.c,v 1.6 2013/06/14 03:54:43 msaitoh Exp $");
|
||||
#endif /* !__lint */
|
||||
|
||||
/* We need the target disklabel.h, not the hosts one..... */
|
||||
#ifdef HAVE_NBTOOL_CONFIG_H
|
||||
#include "nbtool_config.h"
|
||||
#include <nbinclude/sys/disklabel.h>
|
||||
#else
|
||||
#else
|
||||
#include <sys/disklabel.h>
|
||||
#endif
|
||||
#include <sys/param.h>
|
||||
@@ -178,9 +178,10 @@ hp700_setboot(ib_params *params)
|
||||
} else if (be32toh(label.l.d_partitions[0].p_offset) +
|
||||
be32toh(label.l.d_partitions[0].p_size) >
|
||||
((unsigned)2*1024*1024*1024) / secsize) {
|
||||
warnx("WARNING: Partition `a' of `%s' exceeds 2GB boundary.",
|
||||
warnx("Partition `a' of `%s' exceeds 2GB boundary.",
|
||||
params->filesystem);
|
||||
warnx("WARNING: It won't boot since hp700 PDC can handle only 2GB.");
|
||||
warnx("It won't boot since hp700 PDC can handle only 2GB.");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* read boot loader */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: i386.c,v 1.37 2011/08/14 17:50:17 christos Exp $ */
|
||||
/* $NetBSD: i386.c,v 1.40 2013/06/14 03:54:43 msaitoh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if !defined(__lint)
|
||||
__RCSID("$NetBSD: i386.c,v 1.37 2011/08/14 17:50:17 christos Exp $");
|
||||
__RCSID("$NetBSD: i386.c,v 1.40 2013/06/14 03:54:43 msaitoh Exp $");
|
||||
#endif /* !__lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -79,21 +79,19 @@ struct ib_mach ib_mach_i386 =
|
||||
{ "i386", i386_setboot, no_clearboot, i386_editboot,
|
||||
IB_RESETVIDEO | IB_CONSOLE | IB_CONSPEED | IB_CONSADDR |
|
||||
IB_KEYMAP | IB_PASSWORD | IB_TIMEOUT |
|
||||
#if !defined(__minix)
|
||||
IB_MODULES | IB_BOOTCONF |
|
||||
IB_STAGE1START };
|
||||
#else
|
||||
IB_MODULES | IB_BOOTCONF };
|
||||
|
||||
#ifdef __minix
|
||||
struct ib_mach ib_mach_i686 =
|
||||
{ "i686", i386_setboot, no_clearboot, i386_editboot,
|
||||
IB_RESETVIDEO | IB_CONSOLE | IB_CONSPEED | IB_CONSADDR |
|
||||
IB_KEYMAP | IB_PASSWORD | IB_TIMEOUT |
|
||||
IB_MODULES | IB_BOOTCONF };
|
||||
#endif
|
||||
#endif /* !defined(__minix) */
|
||||
|
||||
struct ib_mach ib_mach_amd64 =
|
||||
{ "amd64", i386_setboot, no_clearboot, i386_editboot,
|
||||
IB_RESETVIDEO | IB_CONSOLE | IB_CONSPEED | IB_CONSADDR |
|
||||
IB_KEYMAP | IB_PASSWORD | IB_TIMEOUT |
|
||||
IB_MODULES | IB_BOOTCONF };
|
||||
IB_MODULES | IB_BOOTCONF |
|
||||
IB_STAGE1START };
|
||||
|
||||
/*
|
||||
* Attempting to write the 'labelsector' (or a sector near it - within 8k?)
|
||||
@@ -191,7 +189,7 @@ write_boot_area(ib_params *params, uint8_t *buf, size_t len)
|
||||
bad_write:
|
||||
if (rv == -1)
|
||||
warn("Writing `%s'", params->filesystem);
|
||||
else
|
||||
else
|
||||
warnx("Writing `%s': short write, %u bytes",
|
||||
params->filesystem, rv);
|
||||
return 0;
|
||||
@@ -257,7 +255,7 @@ update_i386_boot_params(ib_params *params, struct x86_boot_params *bpp)
|
||||
if (i == __arraycount(consoles)) {
|
||||
warnx("invalid console name, valid names are:");
|
||||
(void)fprintf(stderr, "\t%s", consoles[0].name);
|
||||
for (i = 1; consoles[i].name != NULL; i++)
|
||||
for (i = 1; i < __arraycount(consoles); i++)
|
||||
(void)fprintf(stderr, ", %s", consoles[i].name);
|
||||
(void)fprintf(stderr, "\n");
|
||||
return 1;
|
||||
@@ -448,6 +446,9 @@ i386_setboot(ib_params *params)
|
||||
/* Old BPB is shorter, leave zero filled */
|
||||
u = disk_buf.b[1];
|
||||
}
|
||||
if (params->s1start != 0)
|
||||
/* Fixup physical offset of filesytem */
|
||||
bpb->bpbHiddenSecs = htole32(params->s1start);
|
||||
memcpy(bootstrap.b + 2, disk_buf.b + 2, u);
|
||||
}
|
||||
#undef USE_F
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: landisk.c,v 1.5 2009/05/07 07:03:39 lukem Exp $ */
|
||||
/* $NetBSD: landisk.c,v 1.6 2013/10/19 17:08:15 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if !defined(__lint)
|
||||
__RCSID("$NetBSD: landisk.c,v 1.5 2009/05/07 07:03:39 lukem Exp $");
|
||||
__RCSID("$NetBSD: landisk.c,v 1.6 2013/10/19 17:08:15 christos Exp $");
|
||||
#endif /* !__lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -68,7 +68,6 @@ landisk_setboot(ib_params *params)
|
||||
size_t bootstrapsize;
|
||||
int retval, i;
|
||||
uint32_t bplen;
|
||||
int bpbsize;
|
||||
|
||||
assert(params != NULL);
|
||||
assert(params->fsfd != -1);
|
||||
@@ -149,11 +148,11 @@ landisk_setboot(ib_params *params)
|
||||
* 2b a0 11 jmp ENDOF(mbr_bpbFAT32)+1, nop
|
||||
* (anything else) ; don't preserve
|
||||
*/
|
||||
bpbsize = 0;
|
||||
#if 0
|
||||
int bpbsize;
|
||||
if (bootstrapbuf[1] == 0xa0 && bootstrapbuf[2] == 0x11 &&
|
||||
(bootstrapbuf[0] == 0x2b /*|| bootstrapbuf[0] == 0x1d*/)) {
|
||||
bpbsize = bootstrapbuf[0] + 2 - MBR_BPB_OFFSET;
|
||||
bpbsize = bootstrapbuf[0] + 2 - MBR_BPB_OFFSET;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: next68k.c,v 1.7 2010/01/07 13:26:00 tsutsui Exp $ */
|
||||
/* $NetBSD: next68k.c,v 1.8 2013/06/14 03:54:43 msaitoh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if !defined(__lint)
|
||||
__RCSID("$NetBSD: next68k.c,v 1.7 2010/01/07 13:26:00 tsutsui Exp $");
|
||||
__RCSID("$NetBSD: next68k.c,v 1.8 2013/06/14 03:54:43 msaitoh Exp $");
|
||||
#endif /* !__lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -154,7 +154,7 @@ next68k_setboot(ib_params *params)
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (bootsize > be16toh(next68klabel->cd_front) * cd_secsize -
|
||||
if (bootsize > be16toh(next68klabel->cd_front) * cd_secsize -
|
||||
NEXT68K_LABEL_SIZE) {
|
||||
warnx("Boot program is larger than front porch space");
|
||||
goto done;
|
||||
@@ -174,7 +174,7 @@ next68k_setboot(ib_params *params)
|
||||
/* can only fit one copy */
|
||||
b0 = b1 = NEXT68K_LABEL_SIZE / cd_secsize;
|
||||
else {
|
||||
if (2 * bootsize > (fp * cd_secsize -
|
||||
if (2 * bootsize > (fp * cd_secsize -
|
||||
NEXT68K_LABEL_DEFAULTBOOT0_1 *
|
||||
params->sectorsize))
|
||||
/* can fit two copies starting after label */
|
||||
@@ -230,7 +230,7 @@ next68k_setboot(ib_params *params)
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
b0 *= sec_netonb_mult;
|
||||
b1 *= sec_netonb_mult;
|
||||
|
||||
@@ -247,7 +247,7 @@ next68k_setboot(ib_params *params)
|
||||
goto done;
|
||||
}
|
||||
if ((size_t)rv != bootsize) {
|
||||
warnx("Writing `%s' at %d: short write",
|
||||
warnx("Writing `%s' at %d: short write",
|
||||
params->filesystem, b0);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pmax.c,v 1.14 2009/04/05 11:55:39 lukem Exp $ */
|
||||
/* $NetBSD: pmax.c,v 1.15 2013/10/21 15:37:46 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2002 The NetBSD Foundation, Inc.
|
||||
@@ -98,7 +98,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if !defined(__lint)
|
||||
__RCSID("$NetBSD: pmax.c,v 1.14 2009/04/05 11:55:39 lukem Exp $");
|
||||
__RCSID("$NetBSD: pmax.c,v 1.15 2013/10/21 15:37:46 christos Exp $");
|
||||
#endif /* !__lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -188,7 +188,7 @@ pmax_setboot(ib_params *params)
|
||||
uint32_t startblock;
|
||||
int retval;
|
||||
char *bootstrapbuf;
|
||||
size_t bootstrapsize;
|
||||
size_t bootstrapsize = 0; /* XXX: gcc */
|
||||
uint32_t bootstrapload, bootstrapexec;
|
||||
ssize_t rv;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vax.c,v 1.13 2009/04/05 11:55:39 lukem Exp $ */
|
||||
/* $NetBSD: vax.c,v 1.17 2013/06/16 19:05:00 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999, 2002 The NetBSD Foundation, Inc.
|
||||
@@ -68,20 +68,30 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if !defined(__lint)
|
||||
__RCSID("$NetBSD: vax.c,v 1.13 2009/04/05 11:55:39 lukem Exp $");
|
||||
__RCSID("$NetBSD: vax.c,v 1.17 2013/06/16 19:05:00 martin Exp $");
|
||||
#endif /* !__lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
#ifdef HAVE_NBTOOL_CONFIG_H
|
||||
#include <nbinclude/vax/disklabel.h>
|
||||
#else
|
||||
#include <sys/disklabel.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <err.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "installboot.h"
|
||||
|
||||
#ifndef __CTASSERT
|
||||
#define __CTASSERT(X)
|
||||
#endif
|
||||
|
||||
static int load_bootstrap(ib_params *, char **,
|
||||
uint32_t *, uint32_t *, size_t *);
|
||||
|
||||
@@ -101,7 +111,7 @@ vax_clearboot(ib_params *params)
|
||||
assert(params != NULL);
|
||||
assert(params->fsfd != -1);
|
||||
assert(params->filesystem != NULL);
|
||||
assert(sizeof(struct vax_boot_block) == VAX_BOOT_BLOCK_BLOCKSIZE);
|
||||
__CTASSERT(sizeof(bb)==VAX_BOOT_BLOCK_BLOCKSIZE);
|
||||
|
||||
rv = pread(params->fsfd, &bb, sizeof(bb), VAX_BOOT_BLOCK_OFFSET);
|
||||
if (rv == -1) {
|
||||
@@ -112,7 +122,7 @@ vax_clearboot(ib_params *params)
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (bb.bb_id_offset * 2 != offsetof(struct vax_boot_block, bb_magic1)
|
||||
if (bb.bb_id_offset*2 >= VAX_BOOT_BLOCK_BLOCKSIZE
|
||||
|| bb.bb_magic1 != VAX_BOOT_MAGIC1) {
|
||||
warnx(
|
||||
"Old boot block magic number invalid; boot block invalid");
|
||||
@@ -154,10 +164,10 @@ static int
|
||||
vax_setboot(ib_params *params)
|
||||
{
|
||||
struct stat bootstrapsb;
|
||||
struct vax_boot_block bb;
|
||||
struct vax_boot_block *bb;
|
||||
uint32_t startblock;
|
||||
int retval;
|
||||
char *bootstrapbuf;
|
||||
char *bootstrapbuf, oldbb[VAX_BOOT_BLOCK_BLOCKSIZE];
|
||||
size_t bootstrapsize;
|
||||
uint32_t bootstrapload, bootstrapexec;
|
||||
ssize_t rv;
|
||||
@@ -167,8 +177,12 @@ vax_setboot(ib_params *params)
|
||||
assert(params->filesystem != NULL);
|
||||
assert(params->s1fd != -1);
|
||||
assert(params->stage1 != NULL);
|
||||
assert(sizeof(struct vax_boot_block) == VAX_BOOT_BLOCK_BLOCKSIZE);
|
||||
|
||||
/* see sys/arch/vax/boot/xxboot/start.S for explanation */
|
||||
__CTASSERT(offsetof(struct vax_boot_block,bb_magic1) == 0x19e);
|
||||
__CTASSERT(sizeof(struct vax_boot_block) == VAX_BOOT_BLOCK_BLOCKSIZE);
|
||||
|
||||
startblock = 0;
|
||||
retval = 0;
|
||||
bootstrapbuf = NULL;
|
||||
|
||||
@@ -184,16 +198,29 @@ vax_setboot(ib_params *params)
|
||||
&bootstrapexec, &bootstrapsize))
|
||||
goto done;
|
||||
|
||||
rv = pread(params->fsfd, &bb, sizeof(bb), VAX_BOOT_BLOCK_OFFSET);
|
||||
/* read old boot block */
|
||||
rv = pread(params->fsfd, oldbb, sizeof(oldbb), VAX_BOOT_BLOCK_OFFSET);
|
||||
if (rv == -1) {
|
||||
warn("Reading `%s'", params->filesystem);
|
||||
goto done;
|
||||
} else if (rv != sizeof(bb)) {
|
||||
} else if (rv != sizeof(oldbb)) {
|
||||
warnx("Reading `%s': short read", params->filesystem);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* fill in the updated boot block fields */
|
||||
/*
|
||||
* Copy disklabel from old boot block to new.
|
||||
* Assume everything between LABELOFFSET and the start of
|
||||
* the param block is scratch area and can be copied over.
|
||||
*/
|
||||
memcpy(bootstrapbuf+LABELOFFSET,
|
||||
oldbb+LABELOFFSET,
|
||||
offsetof(struct vax_boot_block,bb_magic1)-LABELOFFSET);
|
||||
|
||||
/* point to bootblock at begining of bootstrap */
|
||||
bb = (struct vax_boot_block*)bootstrapbuf;
|
||||
|
||||
/* fill in the updated boot block fields */
|
||||
if (params->flags & IB_APPEND) {
|
||||
struct stat filesyssb;
|
||||
|
||||
@@ -209,46 +236,21 @@ vax_setboot(ib_params *params)
|
||||
}
|
||||
startblock = howmany(filesyssb.st_size,
|
||||
VAX_BOOT_BLOCK_BLOCKSIZE);
|
||||
} else if (params->flags & IB_STAGE1START) {
|
||||
startblock = params->s1start;
|
||||
} else {
|
||||
startblock = VAX_BOOT_BLOCK_OFFSET / VAX_BOOT_BLOCK_BLOCKSIZE
|
||||
+ 1;
|
||||
bb->bb_lbn_hi = htole16((uint16_t) (startblock >> 16));
|
||||
bb->bb_lbn_low = htole16((uint16_t) (startblock >> 0));
|
||||
}
|
||||
|
||||
bb.bb_id_offset = offsetof(struct vax_boot_block, bb_magic1) / 2;
|
||||
bb.bb_mbone = 1;
|
||||
bb.bb_lbn_hi = htole16((uint16_t) (startblock >> 16));
|
||||
bb.bb_lbn_low = htole16((uint16_t) (startblock >> 0));
|
||||
/*
|
||||
* Now the identification block
|
||||
*/
|
||||
bb.bb_magic1 = VAX_BOOT_MAGIC1;
|
||||
bb.bb_mbz1 = 0;
|
||||
bb.bb_sum1 = ~(bb.bb_magic1 + bb.bb_mbz1 + bb.bb_pad1);
|
||||
|
||||
bb.bb_mbz2 = 0;
|
||||
bb.bb_volinfo = VAX_BOOT_VOLINFO_NONE;
|
||||
bb.bb_pad2a = 0;
|
||||
bb.bb_pad2b = 0;
|
||||
|
||||
bb.bb_size = htole32(bootstrapsize / VAX_BOOT_BLOCK_BLOCKSIZE);
|
||||
bb.bb_load = htole32(VAX_BOOT_LOAD);
|
||||
bb.bb_entry = htole32(VAX_BOOT_ENTRY);
|
||||
bb.bb_sum3 = htole32(le32toh(bb.bb_size) + le32toh(bb.bb_load) \
|
||||
+ le32toh(bb.bb_entry));
|
||||
|
||||
if (params->flags & IB_SUNSUM) {
|
||||
uint16_t sum;
|
||||
|
||||
sum = compute_sunsum((uint16_t *)&bb);
|
||||
if (! set_sunsum(params, (uint16_t *)&bb, sum))
|
||||
sum = compute_sunsum((uint16_t *)bb);
|
||||
if (! set_sunsum(params, (uint16_t *)bb, sum))
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (params->flags & IB_VERBOSE) {
|
||||
printf("Bootstrap start sector: %u\n", startblock);
|
||||
printf("Bootstrap sector count: %u\n", le32toh(bb.bb_size));
|
||||
printf("Bootstrap sector count: %u\n", le32toh(bb->bb_size));
|
||||
printf("%sriting bootstrap\n",
|
||||
(params->flags & IB_NOWRITE) ? "Not w" : "W");
|
||||
}
|
||||
@@ -256,8 +258,7 @@ vax_setboot(ib_params *params)
|
||||
retval = 1;
|
||||
goto done;
|
||||
}
|
||||
rv = pwrite(params->fsfd, bootstrapbuf, bootstrapsize,
|
||||
startblock * VAX_BOOT_BLOCK_BLOCKSIZE);
|
||||
rv = pwrite(params->fsfd, bootstrapbuf, bootstrapsize, 0);
|
||||
if (rv == -1) {
|
||||
warn("Writing `%s'", params->filesystem);
|
||||
goto done;
|
||||
@@ -265,19 +266,7 @@ vax_setboot(ib_params *params)
|
||||
warnx("Writing `%s': short write", params->filesystem);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (params->flags & IB_VERBOSE)
|
||||
printf("Writing boot block\n");
|
||||
rv = pwrite(params->fsfd, &bb, sizeof(bb), VAX_BOOT_BLOCK_OFFSET);
|
||||
if (rv == -1) {
|
||||
warn("Writing `%s'", params->filesystem);
|
||||
goto done;
|
||||
} else if (rv != sizeof(bb)) {
|
||||
warnx("Writing `%s': short write", params->filesystem);
|
||||
goto done;
|
||||
} else {
|
||||
retval = 1;
|
||||
}
|
||||
retval = 1;
|
||||
|
||||
done:
|
||||
if (bootstrapbuf)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ext2fs.c,v 1.6 2010/01/14 16:27:49 tsutsui Exp $ */
|
||||
/* $NetBSD: ext2fs.c,v 1.9 2013/06/23 02:06:06 dholland Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Manuel Bouyer.
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if !defined(__lint)
|
||||
__RCSID("$NetBSD: ext2fs.c,v 1.6 2010/01/14 16:27:49 tsutsui Exp $");
|
||||
__RCSID("$NetBSD: ext2fs.c,v 1.9 2013/06/23 02:06:06 dholland Exp $");
|
||||
#endif /* !__lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -169,7 +169,7 @@ ext2fs_read_gdblock(ib_params *params, struct m_ext2fs *fs)
|
||||
gdpb = fs->e2fs_bsize / sizeof(struct ext2_gd);
|
||||
|
||||
for (i = 0; i < fs->e2fs_ngdb; i++) {
|
||||
if (ext2fs_read_disk_block(params, fsbtodb(fs,
|
||||
if (ext2fs_read_disk_block(params, EXT2_FSBTODB(fs,
|
||||
fs->e2fs.e2fs_first_dblock + 1 /* superblock */ + i),
|
||||
SBSIZE, gdbuf) == 0)
|
||||
return 0;
|
||||
@@ -236,7 +236,7 @@ ext2fs_find_disk_blocks(ib_params *params, ino_t ino,
|
||||
|
||||
/* Read the inode. */
|
||||
if (ext2fs_read_disk_block(params,
|
||||
fsbtodb(fs, ino_to_fsba(fs, ino)) + params->fstype->offset,
|
||||
EXT2_FSBTODB(fs, ino_to_fsba(fs, ino)) + params->fstype->offset,
|
||||
fs->e2fs_bsize, inodebuf))
|
||||
return 0;
|
||||
inode = (void *)inodebuf;
|
||||
@@ -248,12 +248,12 @@ ext2fs_find_disk_blocks(ib_params *params, ino_t ino,
|
||||
lblk = 0;
|
||||
level_i = 0;
|
||||
level[0].blknums = &inode->e2di_blocks[0];
|
||||
level[0].blkcount = NDADDR;
|
||||
level[1].blknums = &inode->e2di_blocks[NDADDR + 0];
|
||||
level[0].blkcount = UFS_NDADDR;
|
||||
level[1].blknums = &inode->e2di_blocks[UFS_NDADDR + 0];
|
||||
level[1].blkcount = 1;
|
||||
level[2].blknums = &inode->e2di_blocks[NDADDR + 1];
|
||||
level[2].blknums = &inode->e2di_blocks[UFS_NDADDR + 1];
|
||||
level[2].blkcount = 1;
|
||||
level[3].blknums = &inode->e2di_blocks[NDADDR + 2];
|
||||
level[3].blknums = &inode->e2di_blocks[UFS_NDADDR + 2];
|
||||
level[3].blkcount = 1;
|
||||
|
||||
/* Walk the data blocks. */
|
||||
@@ -288,23 +288,23 @@ ext2fs_find_disk_blocks(ib_params *params, ino_t ino,
|
||||
if (blk == 0)
|
||||
memset(level[level_i].diskbuf, 0, MAXBSIZE);
|
||||
else if (ext2fs_read_disk_block(params,
|
||||
fsbtodb(fs, blk) + params->fstype->offset,
|
||||
EXT2_FSBTODB(fs, blk) + params->fstype->offset,
|
||||
fs->e2fs_bsize, level[level_i].diskbuf) == 0)
|
||||
return 0;
|
||||
/* XXX ondisk32 */
|
||||
level[level_i].blknums =
|
||||
(uint32_t *)level[level_i].diskbuf;
|
||||
level[level_i].blkcount = NINDIR(fs);
|
||||
level[level_i].blkcount = EXT2_NINDIR(fs);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* blk is the next direct level block. */
|
||||
#if 0
|
||||
fprintf(stderr, "ino %lu db %lu blksize %lu\n", ino,
|
||||
fsbtodb(fs, blk), sblksize(fs, inode->di_size, lblk));
|
||||
EXT2_FSBTODB(fs, blk), ext2_sblksize(fs, inode->di_size, lblk));
|
||||
#endif
|
||||
rv = (*callback)(params, state,
|
||||
fsbtodb(fs, blk) + params->fstype->offset, fs->e2fs_bsize);
|
||||
EXT2_FSBTODB(fs, blk) + params->fstype->offset, fs->e2fs_bsize);
|
||||
lblk++;
|
||||
nblk--;
|
||||
if (rv != 1)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ffs.c,v 1.29 2010/01/14 16:27:49 tsutsui Exp $ */
|
||||
/* $NetBSD: ffs.c,v 1.32 2013/06/23 02:06:06 dholland Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if !defined(__lint)
|
||||
__RCSID("$NetBSD: ffs.c,v 1.29 2010/01/14 16:27:49 tsutsui Exp $");
|
||||
__RCSID("$NetBSD: ffs.c,v 1.32 2013/06/23 02:06:06 dholland Exp $");
|
||||
#endif /* !__lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@@ -158,7 +158,7 @@ ffs_find_disk_blocks_ufs1(ib_params *params, ino_t ino,
|
||||
|
||||
/* Read the inode. */
|
||||
if (! ffs_read_disk_block(params,
|
||||
fsbtodb(fs, ino_to_fsba(fs, ino)) + params->fstype->offset,
|
||||
FFS_FSBTODB(fs, ino_to_fsba(fs, ino)) + params->fstype->offset,
|
||||
fs->fs_bsize, inodebuf))
|
||||
return (0);
|
||||
inode = (struct ufs1_dinode *)inodebuf;
|
||||
@@ -173,7 +173,7 @@ ffs_find_disk_blocks_ufs1(ib_params *params, ino_t ino,
|
||||
lblk = 0;
|
||||
level_i = 0;
|
||||
level[0].blknums = &inode->di_db[0];
|
||||
level[0].blkcount = NDADDR;
|
||||
level[0].blkcount = UFS_NDADDR;
|
||||
level[1].blknums = &inode->di_ib[0];
|
||||
level[1].blkcount = 1;
|
||||
level[2].blknums = &inode->di_ib[1];
|
||||
@@ -215,24 +215,24 @@ ffs_find_disk_blocks_ufs1(ib_params *params, ino_t ino,
|
||||
if (blk == 0)
|
||||
memset(level[level_i].diskbuf, 0, MAXBSIZE);
|
||||
else if (! ffs_read_disk_block(params,
|
||||
fsbtodb(fs, blk) + params->fstype->offset,
|
||||
FFS_FSBTODB(fs, blk) + params->fstype->offset,
|
||||
fs->fs_bsize, level[level_i].diskbuf))
|
||||
return (0);
|
||||
/* XXX ondisk32 */
|
||||
level[level_i].blknums =
|
||||
(int32_t *)level[level_i].diskbuf;
|
||||
level[level_i].blkcount = NINDIR(fs);
|
||||
level[level_i].blkcount = FFS_NINDIR(fs);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* blk is the next direct level block. */
|
||||
#if 0
|
||||
fprintf(stderr, "ino %lu db %lu blksize %lu\n", ino,
|
||||
fsbtodb(fs, blk), sblksize(fs, inode->di_size, lblk));
|
||||
FFS_FSBTODB(fs, blk), ffs_sblksize(fs, inode->di_size, lblk));
|
||||
#endif
|
||||
rv = (*callback)(params, state,
|
||||
fsbtodb(fs, blk) + params->fstype->offset,
|
||||
sblksize(fs, (int64_t)inode->di_size, lblk));
|
||||
FFS_FSBTODB(fs, blk) + params->fstype->offset,
|
||||
ffs_sblksize(fs, (int64_t)inode->di_size, lblk));
|
||||
lblk++;
|
||||
nblk--;
|
||||
if (rv != 1)
|
||||
@@ -295,7 +295,7 @@ ffs_find_disk_blocks_ufs2(ib_params *params, ino_t ino,
|
||||
|
||||
/* Read the inode. */
|
||||
if (! ffs_read_disk_block(params,
|
||||
fsbtodb(fs, ino_to_fsba(fs, ino)) + params->fstype->offset,
|
||||
FFS_FSBTODB(fs, ino_to_fsba(fs, ino)) + params->fstype->offset,
|
||||
fs->fs_bsize, inodebuf))
|
||||
return (0);
|
||||
inode = (struct ufs2_dinode *)inodebuf;
|
||||
@@ -310,7 +310,7 @@ ffs_find_disk_blocks_ufs2(ib_params *params, ino_t ino,
|
||||
lblk = 0;
|
||||
level_i = 0;
|
||||
level[0].blknums = &inode->di_db[0];
|
||||
level[0].blkcount = NDADDR;
|
||||
level[0].blkcount = UFS_NDADDR;
|
||||
level[1].blknums = &inode->di_ib[0];
|
||||
level[1].blkcount = 1;
|
||||
level[2].blknums = &inode->di_ib[1];
|
||||
@@ -352,23 +352,23 @@ ffs_find_disk_blocks_ufs2(ib_params *params, ino_t ino,
|
||||
if (blk == 0)
|
||||
memset(level[level_i].diskbuf, 0, MAXBSIZE);
|
||||
else if (! ffs_read_disk_block(params,
|
||||
fsbtodb(fs, blk) + params->fstype->offset,
|
||||
FFS_FSBTODB(fs, blk) + params->fstype->offset,
|
||||
fs->fs_bsize, level[level_i].diskbuf))
|
||||
return (0);
|
||||
level[level_i].blknums =
|
||||
(int64_t *)level[level_i].diskbuf;
|
||||
level[level_i].blkcount = NINDIR(fs);
|
||||
level[level_i].blkcount = FFS_NINDIR(fs);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* blk is the next direct level block. */
|
||||
#if 0
|
||||
fprintf(stderr, "ino %lu db %llu blksize %lu\n", ino,
|
||||
fsbtodb(fs, blk), sblksize(fs, inode->di_size, lblk));
|
||||
FFS_FSBTODB(fs, blk), ffs_sblksize(fs, inode->di_size, lblk));
|
||||
#endif
|
||||
rv = (*callback)(params, state,
|
||||
fsbtodb(fs, blk) + params->fstype->offset,
|
||||
sblksize(fs, (int64_t)inode->di_size, lblk));
|
||||
FFS_FSBTODB(fs, blk) + params->fstype->offset,
|
||||
ffs_sblksize(fs, (int64_t)inode->di_size, lblk));
|
||||
lblk++;
|
||||
nblk--;
|
||||
if (rv != 1)
|
||||
@@ -560,10 +560,10 @@ ffs_findstage2(ib_params *params, uint32_t *maxblk, ib_block *blocks)
|
||||
|
||||
/* Get the inode number of the secondary bootstrap. */
|
||||
if (is_ufs2)
|
||||
rv = ffs_find_disk_blocks_ufs2(params, ROOTINO,
|
||||
rv = ffs_find_disk_blocks_ufs2(params, UFS_ROOTINO,
|
||||
ffs_findstage2_ino, &ino);
|
||||
else
|
||||
rv = ffs_find_disk_blocks_ufs1(params, ROOTINO,
|
||||
rv = ffs_find_disk_blocks_ufs1(params, UFS_ROOTINO,
|
||||
ffs_findstage2_ino, &ino);
|
||||
if (rv != 2) {
|
||||
warnx("Could not find secondary bootstrap `%s' in `%s'",
|
||||
|
||||
@@ -40,7 +40,6 @@ __RCSID("$NetBSD: installboot.c,v 1.36 2011/11/03 20:46:41 martin Exp $");
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/ttycom.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <err.h>
|
||||
@@ -193,7 +192,11 @@ main(int argc, char *argv[])
|
||||
if (params->machine == NULL) {
|
||||
if (uname(&utsname) == -1)
|
||||
err(1, "Determine uname");
|
||||
#if !defined(__minix)
|
||||
getmachine(params, utsname.machine, "uname()");
|
||||
#else
|
||||
getmachine(params, utsname.arch, "uname()");
|
||||
#endif /* !defined(__minix) */
|
||||
}
|
||||
|
||||
/* Check that options are supported by this system */
|
||||
|
||||
@@ -55,9 +55,6 @@ struct ib_mach
|
||||
ib_mach_hp300,
|
||||
ib_mach_hp700,
|
||||
ib_mach_i386,
|
||||
#ifdef __minix
|
||||
ib_mach_i686,
|
||||
#endif
|
||||
ib_mach_landisk,
|
||||
ib_mach_macppc,
|
||||
ib_mach_news68k,
|
||||
@@ -80,9 +77,6 @@ struct ib_mach * const machines[] = {
|
||||
&ib_mach_hp300,
|
||||
&ib_mach_hp700,
|
||||
&ib_mach_i386,
|
||||
#ifdef __minix
|
||||
&ib_mach_i686,
|
||||
#endif
|
||||
&ib_mach_landisk,
|
||||
&ib_mach_macppc,
|
||||
&ib_mach_news68k,
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
SUBDIR= v3
|
||||
|
||||
.if !defined(HOSTPROGNAME)
|
||||
#SUBDIR+= v1 v2 # Original V1 and V2 file systems
|
||||
#SUBDIR+= v1l v2l # Linux-extended variants
|
||||
#SUBDIR+= mfs3v2 # V2 as handled by regular MINIX 3.x; hacky
|
||||
.endif
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
.include <bsd.subdir.mk>
|
||||
@@ -1,4 +1,4 @@
|
||||
SRCS= mkfs.c
|
||||
SRCS= mkfs.c
|
||||
BINDIR?= /usr/sbin
|
||||
MAN?=
|
||||
|
||||
@@ -10,8 +10,12 @@ MAN?=
|
||||
CPPFLAGS+= -I${.CURDIR}
|
||||
|
||||
.if ${HOST_OSTYPE:C/\-.*//:U} == "Minix" || !defined(HOSTPROGNAME)
|
||||
#DPADD
|
||||
#LSC: FIXME This should not be required, more so only on Minix...
|
||||
LDADD+= -lminlib -lcompat_minix
|
||||
DPADD+= ${MINLIB} ${COMPAT_MINIX}
|
||||
.endif
|
||||
|
||||
NOGCCERROR?= yes
|
||||
NOCLANGERROR?= yes
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
PROG= mkfs.mfs
|
||||
BINDIR= /sbin
|
||||
PROG= mkfs.mfsv3
|
||||
|
||||
# XXX consider section 8
|
||||
MAN= mkfs.mfs.1
|
||||
|
||||
.ifndef HOSTPROGNAME
|
||||
SYMLINKS+= $(BINDIR)/$(PROG) /usr/sbin/mkfs.mfs3
|
||||
.if !defined(HOSTPROGNAME)
|
||||
# The default MFS version is v3
|
||||
SYMLINKS+= ${BINDIR}/${PROG} /usr/sbin/newfs_mfs
|
||||
SYMLINKS+= ${BINDIR}/${PROG} /sbin/mkfs.mfs
|
||||
MLINKS+= mkfs.mfs.1 newfs_mfs.1
|
||||
.endif
|
||||
|
||||
.include <../Makefile.mkfs>
|
||||
|
||||
@@ -4,4 +4,7 @@ MAN=
|
||||
LDADD+= -lminlib
|
||||
DPADD+= ${LIBMINLIB}
|
||||
|
||||
NOGCCERROR?= yes
|
||||
NOCLANGERROR?= yes
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.33 2012/10/05 01:26:56 christos Exp $
|
||||
# $NetBSD: Makefile,v 1.34 2013/02/03 19:15:16 christos Exp $
|
||||
# from: @(#)Makefile 8.2 (Berkeley) 4/27/95
|
||||
|
||||
.include <bsd.own.mk>
|
||||
@@ -8,7 +8,7 @@ PROG= mtree
|
||||
CPPFLAGS+= -DMTREE
|
||||
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
|
||||
verify.c getid.c pack_dev.c only.c
|
||||
.if (${HOSTPROG:U} == "")
|
||||
.if defined(__MINIX)
|
||||
CPPFLAGS+= -Dlchown=chown -Dlchmod=chmod
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: compare.c,v 1.55 2012/10/05 00:59:35 christos Exp $ */
|
||||
/* $NetBSD: compare.c,v 1.58 2013/11/21 18:39:50 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1989, 1993
|
||||
@@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)compare.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: compare.c,v 1.55 2012/10/05 00:59:35 christos Exp $");
|
||||
__RCSID("$NetBSD: compare.c,v 1.58 2013/11/21 18:39:50 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -48,6 +48,7 @@ __RCSID("$NetBSD: compare.c,v 1.55 2012/10/05 00:59:35 christos Exp $");
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
@@ -71,13 +72,18 @@ __RCSID("$NetBSD: compare.c,v 1.55 2012/10/05 00:59:35 christos Exp $");
|
||||
#define INDENTNAMELEN 8
|
||||
#define MARK \
|
||||
do { \
|
||||
len = printf("%s: ", RP(p)); \
|
||||
if (len > INDENTNAMELEN) { \
|
||||
if (flavor == F_FREEBSD9) { \
|
||||
len = printf("%s changed\n", RP(p)); \
|
||||
tab = "\t"; \
|
||||
printf("\n"); \
|
||||
} else { \
|
||||
tab = ""; \
|
||||
printf("%*s", INDENTNAMELEN - (int)len, ""); \
|
||||
len = printf("%s: ", RP(p)); \
|
||||
if (len > INDENTNAMELEN) { \
|
||||
tab = "\t"; \
|
||||
printf("\n"); \
|
||||
} else { \
|
||||
tab = ""; \
|
||||
printf("%*s", INDENTNAMELEN - (int)len, ""); \
|
||||
} \
|
||||
} \
|
||||
} while (0)
|
||||
#define LABEL if (!label++) MARK
|
||||
@@ -126,22 +132,6 @@ do { \
|
||||
} while (0)
|
||||
#endif /* HAVE_STRUCT_STAT_ST_FLAGS */
|
||||
|
||||
#ifdef __minix
|
||||
#if 0
|
||||
int
|
||||
lchmod(const char *path, mode_t flags)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
lchown(const char *path, uid_t owner, gid_t group)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int
|
||||
compare(NODE *s, FTSENT *p)
|
||||
{
|
||||
@@ -189,7 +179,8 @@ compare(NODE *s, FTSENT *p)
|
||||
break;
|
||||
#endif
|
||||
typeerr: LABEL;
|
||||
printf("\ttype (%s, %s)\n",
|
||||
printf(flavor == F_FREEBSD9 ?
|
||||
"\ttype expected %s found %s\n" : "\ttype (%s, %s)\n",
|
||||
nodetype(s->type), inotype(p->fts_statp->st_mode));
|
||||
return (label);
|
||||
}
|
||||
@@ -211,9 +202,11 @@ typeerr: LABEL;
|
||||
(s->type == F_BLOCK || s->type == F_CHAR) &&
|
||||
s->st_rdev != p->fts_statp->st_rdev) {
|
||||
LABEL;
|
||||
printf("%sdevice (%#llx, %#llx",
|
||||
tab, (long long)s->st_rdev,
|
||||
(long long)p->fts_statp->st_rdev);
|
||||
printf(flavor == F_FREEBSD9 ?
|
||||
"%sdevice expected %#jx found %#jx" :
|
||||
"%sdevice (%#jx, %#jx",
|
||||
tab, (uintmax_t)s->st_rdev,
|
||||
(uintmax_t)p->fts_statp->st_rdev);
|
||||
if (uflag) {
|
||||
if ((unlink(p->fts_accpath) == -1) ||
|
||||
(mknod(p->fts_accpath,
|
||||
@@ -221,10 +214,12 @@ typeerr: LABEL;
|
||||
s->st_rdev) == -1) ||
|
||||
(lchown(p->fts_accpath, p->fts_statp->st_uid,
|
||||
p->fts_statp->st_gid) == -1) )
|
||||
printf(", not modified: %s)\n",
|
||||
strerror(errno));
|
||||
printf(", not modified: %s%s\n",
|
||||
strerror(errno),
|
||||
flavor == F_FREEBSD9 ? "" : ")");
|
||||
else
|
||||
printf(", modified)\n");
|
||||
printf(", modified%s\n",
|
||||
flavor == F_FREEBSD9 ? "" : ")");
|
||||
} else
|
||||
printf(")\n");
|
||||
tab = "\t";
|
||||
@@ -232,28 +227,34 @@ typeerr: LABEL;
|
||||
/* Set the uid/gid first, then set the mode. */
|
||||
if (s->flags & (F_UID | F_UNAME) && s->st_uid != p->fts_statp->st_uid) {
|
||||
LABEL;
|
||||
printf("%suser (%lu, %lu",
|
||||
printf(flavor == F_FREEBSD9 ?
|
||||
"%suser expected %lu found %lu" : "%suser (%lu, %lu",
|
||||
tab, (u_long)s->st_uid, (u_long)p->fts_statp->st_uid);
|
||||
if (uflag) {
|
||||
if (lchown(p->fts_accpath, s->st_uid, -1))
|
||||
printf(", not modified: %s)\n",
|
||||
strerror(errno));
|
||||
printf(", not modified: %s%s\n",
|
||||
strerror(errno),
|
||||
flavor == F_FREEBSD9 ? "" : ")");
|
||||
else
|
||||
printf(", modified)\n");
|
||||
printf(", modified%s\n",
|
||||
flavor == F_FREEBSD9 ? "" : ")");
|
||||
} else
|
||||
printf(")\n");
|
||||
tab = "\t";
|
||||
}
|
||||
if (s->flags & (F_GID | F_GNAME) && s->st_gid != p->fts_statp->st_gid) {
|
||||
LABEL;
|
||||
printf("%sgid (%lu, %lu",
|
||||
printf(flavor == F_FREEBSD9 ?
|
||||
"%sgid expected %lu found %lu" : "%sgid (%lu, %lu",
|
||||
tab, (u_long)s->st_gid, (u_long)p->fts_statp->st_gid);
|
||||
if (uflag) {
|
||||
if (lchown(p->fts_accpath, -1, s->st_gid))
|
||||
printf(", not modified: %s)\n",
|
||||
strerror(errno));
|
||||
printf(", not modified: %s%s\n",
|
||||
strerror(errno),
|
||||
flavor == F_FREEBSD9 ? "" : ")");
|
||||
else
|
||||
printf(", modified)\n");
|
||||
printf(", modified%s\n",
|
||||
flavor == F_FREEBSD9 ? "" : ")");
|
||||
}
|
||||
else
|
||||
printf(")\n");
|
||||
@@ -278,15 +279,19 @@ typeerr: LABEL;
|
||||
}
|
||||
|
||||
LABEL;
|
||||
printf("%spermissions (%#lo, %#lo",
|
||||
printf(flavor == F_FREEBSD9 ?
|
||||
"%spermissions expcted %#lo found %#lo" :
|
||||
"%spermissions (%#lo, %#lo",
|
||||
tab, (u_long)s->st_mode,
|
||||
(u_long)p->fts_statp->st_mode & MBITS);
|
||||
if (uflag) {
|
||||
if (lchmod(p->fts_accpath, s->st_mode))
|
||||
printf(", not modified: %s)\n",
|
||||
strerror(errno));
|
||||
printf(", not modified: %s%s\n",
|
||||
strerror(errno),
|
||||
flavor == F_FREEBSD9 ? "" : ")");
|
||||
else
|
||||
printf(", modified)\n");
|
||||
printf(", modified%s\n",
|
||||
flavor == F_FREEBSD9 ? "" : ")");
|
||||
}
|
||||
else
|
||||
printf(")\n");
|
||||
@@ -296,15 +301,18 @@ typeerr: LABEL;
|
||||
if (s->flags & F_NLINK && s->type != F_DIR &&
|
||||
s->st_nlink != p->fts_statp->st_nlink) {
|
||||
LABEL;
|
||||
printf("%slink count (%lu, %lu)\n",
|
||||
printf(flavor == F_FREEBSD9 ?
|
||||
"%slink count expected %lu found %lu\n" :
|
||||
"%slink count (%lu, %lu)\n",
|
||||
tab, (u_long)s->st_nlink, (u_long)p->fts_statp->st_nlink);
|
||||
tab = "\t";
|
||||
}
|
||||
if (s->flags & F_SIZE && s->st_size != p->fts_statp->st_size) {
|
||||
LABEL;
|
||||
printf("%ssize (%lld, %lld)\n",
|
||||
tab, (long long)s->st_size,
|
||||
(long long)p->fts_statp->st_size);
|
||||
printf(flavor == F_FREEBSD9 ?
|
||||
"%ssize expected %ju found %ju\n" : "%ssize (%ju, %ju)\n",
|
||||
tab, (uintmax_t)s->st_size,
|
||||
(uintmax_t)p->fts_statp->st_size);
|
||||
tab = "\t";
|
||||
}
|
||||
/*
|
||||
@@ -337,18 +345,22 @@ typeerr: LABEL;
|
||||
if (tv[0].tv_sec != tv[1].tv_sec ||
|
||||
tv[0].tv_usec != tv[1].tv_usec) {
|
||||
LABEL;
|
||||
printf("%smodification time (%.24s, ",
|
||||
printf(flavor == F_FREEBSD9 ?
|
||||
"%smodification time expected %.24s found " :
|
||||
"%smodification time (%.24s, ",
|
||||
tab, ctime(&smtime));
|
||||
printf("%.24s", ctime(&pmtime));
|
||||
if (tflag) {
|
||||
tv[1] = tv[0];
|
||||
if (utimes(p->fts_accpath, tv))
|
||||
printf(", not modified: %s)\n",
|
||||
strerror(errno));
|
||||
printf(", not modified: %s%s\n",
|
||||
strerror(errno),
|
||||
flavor == F_FREEBSD9 ? "" : ")");
|
||||
else
|
||||
printf(", modified)\n");
|
||||
printf(", modified%s\n",
|
||||
flavor == F_FREEBSD9 ? "" : ")");
|
||||
} else
|
||||
printf(")\n");
|
||||
printf("%s\n", flavor == F_FREEBSD9 ? "" : ")");
|
||||
tab = "\t";
|
||||
}
|
||||
}
|
||||
@@ -365,7 +377,9 @@ typeerr: LABEL;
|
||||
char *f_s;
|
||||
LABEL;
|
||||
f_s = flags_to_string(s->st_flags, "none");
|
||||
printf("%sflags (\"%s\" is not ", tab, f_s);
|
||||
printf(flavor == F_FREEBSD9 ?
|
||||
"%sflags expected \"%s\" found " :
|
||||
"%sflags (\"%s\" is not ", tab, f_s);
|
||||
free(f_s);
|
||||
f_s = flags_to_string(p->fts_statp->st_flags, "none");
|
||||
printf("\"%s\"", f_s);
|
||||
@@ -379,7 +393,7 @@ typeerr: LABEL;
|
||||
else
|
||||
SETFLAGS(0, (~SP_FLGS & CH_MASK));
|
||||
} else
|
||||
printf(")\n");
|
||||
printf("%s\n", flavor == F_FREEBSD9 ? "" : ")");
|
||||
tab = "\t";
|
||||
}
|
||||
#endif /* HAVE_STRUCT_STAT_ST_FLAGS */
|
||||
@@ -405,7 +419,9 @@ typeerr: LABEL;
|
||||
close(fd);
|
||||
if (s->cksum != val) {
|
||||
LABEL;
|
||||
printf("%scksum (%lu, %lu)\n",
|
||||
printf(flavor == F_FREEBSD9 ?
|
||||
"%scksum expected %lu found %lu\n" :
|
||||
"%scksum (%lu, %lu)\n",
|
||||
tab, s->cksum, (unsigned long)val);
|
||||
}
|
||||
tab = "\t";
|
||||
@@ -421,7 +437,9 @@ typeerr: LABEL;
|
||||
} else {
|
||||
if (strcmp(s->md5digest, digestbuf)) {
|
||||
LABEL;
|
||||
printf("%s%s (0x%s, 0x%s)\n",
|
||||
printf(flavor == F_FREEBSD9 ?
|
||||
"%s%s expected %s found %s\n" :
|
||||
"%s%s (0x%s, 0x%s)\n",
|
||||
tab, MD5KEY, s->md5digest, digestbuf);
|
||||
}
|
||||
tab = "\t";
|
||||
@@ -439,7 +457,9 @@ typeerr: LABEL;
|
||||
} else {
|
||||
if (strcmp(s->rmd160digest, digestbuf)) {
|
||||
LABEL;
|
||||
printf("%s%s (0x%s, 0x%s)\n",
|
||||
printf(flavor == F_FREEBSD9 ?
|
||||
"%s%s expected %s found %s\n" :
|
||||
"%s%s (0x%s, 0x%s)\n",
|
||||
tab, RMD160KEY, s->rmd160digest, digestbuf);
|
||||
}
|
||||
tab = "\t";
|
||||
@@ -457,7 +477,9 @@ typeerr: LABEL;
|
||||
} else {
|
||||
if (strcmp(s->sha1digest, digestbuf)) {
|
||||
LABEL;
|
||||
printf("%s%s (0x%s, 0x%s)\n",
|
||||
printf(flavor == F_FREEBSD9 ?
|
||||
"%s%s expected %s found %s\n" :
|
||||
"%s%s (0x%s, 0x%s)\n",
|
||||
tab, SHA1KEY, s->sha1digest, digestbuf);
|
||||
}
|
||||
tab = "\t";
|
||||
@@ -475,7 +497,9 @@ typeerr: LABEL;
|
||||
} else {
|
||||
if (strcmp(s->sha256digest, digestbuf)) {
|
||||
LABEL;
|
||||
printf("%s%s (0x%s, 0x%s)\n",
|
||||
printf(flavor == F_FREEBSD9 ?
|
||||
"%s%s expected %s found %s\n" :
|
||||
"%s%s (0x%s, 0x%s)\n",
|
||||
tab, SHA256KEY, s->sha256digest, digestbuf);
|
||||
}
|
||||
tab = "\t";
|
||||
@@ -492,7 +516,9 @@ typeerr: LABEL;
|
||||
} else {
|
||||
if (strcmp(s->sha384digest, digestbuf)) {
|
||||
LABEL;
|
||||
printf("%s%s (0x%s, 0x%s)\n",
|
||||
printf(flavor == F_FREEBSD9 ?
|
||||
"%s%s expected %s found %s\n" :
|
||||
"%s%s (0x%s, 0x%s)\n",
|
||||
tab, SHA384KEY, s->sha384digest, digestbuf);
|
||||
}
|
||||
tab = "\t";
|
||||
@@ -509,7 +535,9 @@ typeerr: LABEL;
|
||||
} else {
|
||||
if (strcmp(s->sha512digest, digestbuf)) {
|
||||
LABEL;
|
||||
printf("%s%s (0x%s, 0x%s)\n",
|
||||
printf(flavor == F_FREEBSD9 ?
|
||||
"%s%s expected %s found %s\n" :
|
||||
"%s%s (0x%s, 0x%s)\n",
|
||||
tab, SHA512KEY, s->sha512digest, digestbuf);
|
||||
}
|
||||
tab = "\t";
|
||||
@@ -520,16 +548,20 @@ typeerr: LABEL;
|
||||
if (s->flags & F_SLINK &&
|
||||
strcmp(cp = rlink(p->fts_accpath), s->slink)) {
|
||||
LABEL;
|
||||
printf("%slink ref (%s, %s", tab, cp, s->slink);
|
||||
printf(flavor == F_FREEBSD9 ?
|
||||
"%slink ref expected %s found %s" :
|
||||
"%slink ref (%s, %s", tab, cp, s->slink);
|
||||
if (uflag) {
|
||||
if ((unlink(p->fts_accpath) == -1) ||
|
||||
(symlink(s->slink, p->fts_accpath) == -1) )
|
||||
printf(", not modified: %s)\n",
|
||||
strerror(errno));
|
||||
printf(", not modified: %s%s\n",
|
||||
strerror(errno),
|
||||
flavor == F_FREEBSD9 ? "" : ")");
|
||||
else
|
||||
printf(", modified)\n");
|
||||
printf(", modified%s\n",
|
||||
flavor == F_FREEBSD9 ? "" : ")");
|
||||
} else
|
||||
printf(")\n");
|
||||
printf("%s\n", flavor == F_FREEBSD9 ? "" : ")");
|
||||
}
|
||||
return (label);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: create.c,v 1.65 2012/10/05 01:21:44 christos Exp $ */
|
||||
/* $NetBSD: create.c,v 1.72 2013/10/17 17:22:59 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1989, 1993
|
||||
@@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)create.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: create.c,v 1.65 2012/10/05 01:21:44 christos Exp $");
|
||||
__RCSID("$NetBSD: create.c,v 1.72 2013/10/17 17:22:59 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -55,6 +55,7 @@ __RCSID("$NetBSD: create.c,v 1.65 2012/10/05 01:21:44 christos Exp $");
|
||||
#include <pwd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
@@ -134,17 +135,29 @@ cwalk(void)
|
||||
fts_set(t, p, FTS_SKIP);
|
||||
continue;
|
||||
}
|
||||
if (!find_only(p->fts_path)) {
|
||||
fts_set(t, p, FTS_SKIP);
|
||||
continue;
|
||||
}
|
||||
switch(p->fts_info) {
|
||||
case FTS_D:
|
||||
if (!bflag)
|
||||
printf("\n");
|
||||
if (!nflag)
|
||||
printf("\n# %s\n", p->fts_path);
|
||||
printf("# %s\n", p->fts_path);
|
||||
statd(t, p, &uid, &gid, &mode, &flags);
|
||||
statf(indent, p);
|
||||
break;
|
||||
case FTS_DP:
|
||||
if (!nflag && p->fts_level > 0)
|
||||
printf("%*s# %s\n%*s..\n\n", indent, "",
|
||||
p->fts_path, indent, "");
|
||||
if (p->fts_level > 0)
|
||||
if (!nflag)
|
||||
printf("%*s# %s\n", indent, "",
|
||||
p->fts_path);
|
||||
if (p->fts_level > 0 || flavor == F_FREEBSD9) {
|
||||
printf("%*s..\n", indent, "");
|
||||
if (!bflag)
|
||||
printf("\n");
|
||||
}
|
||||
break;
|
||||
case FTS_DNR:
|
||||
case FTS_ERR:
|
||||
@@ -182,7 +195,7 @@ statf(int indent, FTSENT *p)
|
||||
else
|
||||
offset += printf("%*s", (INDENTNAMELEN + indent) - offset, "");
|
||||
|
||||
if (!S_ISREG(p->fts_statp->st_mode))
|
||||
if (!S_ISREG(p->fts_statp->st_mode) && (flavor == F_NETBSD6 || !dflag))
|
||||
output(indent, &offset, "type=%s",
|
||||
inotype(p->fts_statp->st_mode));
|
||||
if (keys & (F_UID | F_UNAME) && p->fts_statp->st_uid != uid) {
|
||||
@@ -204,21 +217,22 @@ statf(int indent, FTSENT *p)
|
||||
p->fts_statp->st_mode & MBITS);
|
||||
if (keys & F_DEV &&
|
||||
(S_ISBLK(p->fts_statp->st_mode) || S_ISCHR(p->fts_statp->st_mode)))
|
||||
output(indent, &offset, "device=%#llx",
|
||||
(long long)p->fts_statp->st_rdev);
|
||||
output(indent, &offset, "device=%#jx",
|
||||
(uintmax_t)p->fts_statp->st_rdev);
|
||||
if (keys & F_NLINK && p->fts_statp->st_nlink != 1)
|
||||
output(indent, &offset, "nlink=%u", p->fts_statp->st_nlink);
|
||||
if (keys & F_SIZE && S_ISREG(p->fts_statp->st_mode))
|
||||
output(indent, &offset, "size=%lld",
|
||||
(long long)p->fts_statp->st_size);
|
||||
if (keys & F_SIZE &&
|
||||
(flavor == F_FREEBSD9 || S_ISREG(p->fts_statp->st_mode)))
|
||||
output(indent, &offset, "size=%ju",
|
||||
(uintmax_t)p->fts_statp->st_size);
|
||||
if (keys & F_TIME)
|
||||
#if defined(BSD4_4) && !defined(HAVE_NBTOOL_CONFIG_H)
|
||||
output(indent, &offset, "time=%ld.%09ld",
|
||||
(long)p->fts_statp->st_mtimespec.tv_sec,
|
||||
output(indent, &offset, "time=%jd.%09ld",
|
||||
(intmax_t)p->fts_statp->st_mtimespec.tv_sec,
|
||||
p->fts_statp->st_mtimespec.tv_nsec);
|
||||
#else
|
||||
output(indent, &offset, "time=%ld.%09ld",
|
||||
(long)p->fts_statp->st_mtime, (long)0);
|
||||
output(indent, &offset, "time=%jd.%09ld",
|
||||
(intmax_t)p->fts_statp->st_mtime, (long)0);
|
||||
#endif
|
||||
if (keys & F_CKSUM && S_ISREG(p->fts_statp->st_mode)) {
|
||||
if ((fd = open(p->fts_accpath, O_RDONLY, 0)) < 0 ||
|
||||
@@ -347,29 +361,32 @@ statd(FTS *t, FTSENT *parent, uid_t *puid, gid_t *pgid, mode_t *pmode,
|
||||
|
||||
maxuid = maxgid = maxmode = maxflags = 0;
|
||||
for (; p; p = p->fts_link) {
|
||||
smode = p->fts_statp->st_mode & MBITS;
|
||||
if (smode < MTREE_MAXMODE && ++m[smode] > maxmode) {
|
||||
savemode = smode;
|
||||
maxmode = m[smode];
|
||||
}
|
||||
sgid = p->fts_statp->st_gid;
|
||||
if (sgid < MTREE_MAXGID && ++g[sgid] > maxgid) {
|
||||
savegid = sgid;
|
||||
maxgid = g[sgid];
|
||||
}
|
||||
suid = p->fts_statp->st_uid;
|
||||
if (suid < MTREE_MAXUID && ++u[suid] > maxuid) {
|
||||
saveuid = suid;
|
||||
maxuid = u[suid];
|
||||
}
|
||||
if (flavor == F_NETBSD6 || !dflag ||
|
||||
(dflag && S_ISDIR(p->fts_statp->st_mode))) {
|
||||
smode = p->fts_statp->st_mode & MBITS;
|
||||
if (smode < MTREE_MAXMODE && ++m[smode] > maxmode) {
|
||||
savemode = smode;
|
||||
maxmode = m[smode];
|
||||
}
|
||||
sgid = p->fts_statp->st_gid;
|
||||
if (sgid < MTREE_MAXGID && ++g[sgid] > maxgid) {
|
||||
savegid = sgid;
|
||||
maxgid = g[sgid];
|
||||
}
|
||||
suid = p->fts_statp->st_uid;
|
||||
if (suid < MTREE_MAXUID && ++u[suid] > maxuid) {
|
||||
saveuid = suid;
|
||||
maxuid = u[suid];
|
||||
}
|
||||
|
||||
#if HAVE_STRUCT_STAT_ST_FLAGS
|
||||
sflags = FLAGS2INDEX(p->fts_statp->st_flags);
|
||||
if (sflags < MTREE_MAXFLAGS && ++f[sflags] > maxflags) {
|
||||
saveflags = p->fts_statp->st_flags;
|
||||
maxflags = f[sflags];
|
||||
}
|
||||
sflags = FLAGS2INDEX(p->fts_statp->st_flags);
|
||||
if (sflags < MTREE_MAXFLAGS && ++f[sflags] > maxflags) {
|
||||
saveflags = p->fts_statp->st_flags;
|
||||
maxflags = f[sflags];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If the /set record is the same as the last one we do not need to
|
||||
@@ -382,7 +399,10 @@ statd(FTS *t, FTSENT *parent, uid_t *puid, gid_t *pgid, mode_t *pmode,
|
||||
((keys & F_FLAGS) && (*pflags != saveflags)) ||
|
||||
first) {
|
||||
first = 0;
|
||||
printf("/set type=file");
|
||||
if (flavor != F_NETBSD6 && dflag)
|
||||
printf("/set type=dir");
|
||||
else
|
||||
printf("/set type=file");
|
||||
if (keys & (F_UID | F_UNAME)) {
|
||||
if (keys & F_UNAME &&
|
||||
(name = user_from_uid(saveuid, 1)) != NULL)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: extern.h,v 1.36 2012/10/05 01:26:56 christos Exp $ */
|
||||
/* $NetBSD: extern.h,v 1.38 2013/02/03 19:15:17 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@@ -36,14 +36,15 @@
|
||||
#if HAVE_NBTOOL_CONFIG_H
|
||||
#include "nbtool_config.h"
|
||||
#else
|
||||
#ifndef __minix
|
||||
#if !defined(__minix)
|
||||
#define HAVE_STRUCT_STAT_ST_FLAGS 1
|
||||
#endif
|
||||
#endif
|
||||
#endif /* !defined(__minix) */
|
||||
|
||||
#include <err.h>
|
||||
#include <fts.h>
|
||||
#include <util.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#if HAVE_NETDB_H
|
||||
/* For MAXHOSTNAMELEN on some platforms. */
|
||||
@@ -54,6 +55,12 @@
|
||||
#define MAXHOSTNAMELEN 256
|
||||
#endif
|
||||
|
||||
enum flavor {
|
||||
F_MTREE,
|
||||
F_FREEBSD9,
|
||||
F_NETBSD6
|
||||
};
|
||||
|
||||
void addtag(slist_t *, char *);
|
||||
int check_excludes(const char *, const char *);
|
||||
int compare(NODE *, FTSENT *);
|
||||
@@ -70,11 +77,14 @@ u_int parsetype(const char *);
|
||||
void read_excludes_file(const char *);
|
||||
const char *rlink(const char *);
|
||||
int verify(FILE *);
|
||||
void load_only(const char *fname);
|
||||
bool find_only(const char *path);
|
||||
|
||||
extern int dflag, eflag, iflag, jflag, lflag, mflag,
|
||||
extern int bflag, dflag, eflag, iflag, jflag, lflag, mflag,
|
||||
nflag, qflag, rflag, sflag, tflag, uflag;
|
||||
extern int mtree_Mflag, mtree_Sflag, mtree_Wflag;
|
||||
extern size_t mtree_lineno;
|
||||
extern enum flavor flavor;
|
||||
extern u_int32_t crc_total;
|
||||
extern int ftsoptions, keys;
|
||||
extern char fullpath[];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: getid.c,v 1.7 2008/04/28 20:24:17 martin Exp $ */
|
||||
/* $NetBSD: getid.c,v 1.8 2013/10/16 17:27:42 christos Exp $ */
|
||||
/* from: NetBSD: getpwent.c,v 1.48 2000/10/03 03:22:26 enami Exp */
|
||||
/* from: NetBSD: getgrent.c,v 1.41 2002/01/12 23:51:30 lukem Exp */
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
#endif
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: getid.c,v 1.7 2008/04/28 20:24:17 martin Exp $");
|
||||
__RCSID("$NetBSD: getid.c,v 1.8 2013/10/16 17:27:42 christos Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
@@ -230,6 +230,9 @@ grscan(int search, gid_t gid, const char *name)
|
||||
;
|
||||
continue;
|
||||
}
|
||||
/* skip comments */
|
||||
if (pwline[0] == '#')
|
||||
continue;
|
||||
if (grmatchline(search, gid, name))
|
||||
return 1;
|
||||
}
|
||||
@@ -371,6 +374,9 @@ pwscan(int search, uid_t uid, const char *name)
|
||||
;
|
||||
continue;
|
||||
}
|
||||
/* skip comments */
|
||||
if (pwline[0] == '#')
|
||||
continue;
|
||||
if (pwmatchline(search, uid, name))
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: misc.c,v 1.32 2012/10/05 01:31:05 christos Exp $ */
|
||||
/* $NetBSD: misc.c,v 1.34 2012/12/20 19:09:25 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(__RCSID) && !defined(lint)
|
||||
__RCSID("$NetBSD: misc.c,v 1.32 2012/10/05 01:31:05 christos Exp $");
|
||||
__RCSID("$NetBSD: misc.c,v 1.34 2012/12/20 19:09:25 christos Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -50,6 +50,12 @@ __RCSID("$NetBSD: misc.c,v 1.32 2012/10/05 01:31:05 christos Exp $");
|
||||
|
||||
#include "extern.h"
|
||||
|
||||
#if 1 /* defined(__minix): LSC: our mkfs doesn't understand escaped names,
|
||||
so always default to netbsd6 escaping mode. */
|
||||
enum flavor flavor = F_NETBSD6;
|
||||
#else
|
||||
enum flavor flavor = F_MTREE;
|
||||
#endif /* defined(__minix) */
|
||||
typedef struct _key {
|
||||
const char *name; /* key name */
|
||||
u_int val; /* value */
|
||||
@@ -74,7 +80,6 @@ static KEY keylist[] = {
|
||||
{"nochange", F_NOCHANGE, 0},
|
||||
{"optional", F_OPT, 0},
|
||||
{"ripemd160digest", F_RMD160, NEEDVALUE},
|
||||
{"rmd160digest",F_RMD160, NEEDVALUE},
|
||||
{"rmd160", F_RMD160, NEEDVALUE},
|
||||
{"rmd160digest",F_RMD160, NEEDVALUE},
|
||||
{"sha1", F_SHA1, NEEDVALUE},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: mtree.8,v 1.63 2012/10/05 09:18:02 wiz Exp $
|
||||
.\" $NetBSD: mtree.8,v 1.69 2013/02/03 19:16:06 christos Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1989, 1990, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@@ -56,7 +56,7 @@
|
||||
.\"
|
||||
.\" @(#)mtree.8 8.2 (Berkeley) 12/11/93
|
||||
.\"
|
||||
.Dd October 4, 2012
|
||||
.Dd February 3, 2013
|
||||
.Dt MTREE 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -64,14 +64,16 @@
|
||||
.Nd map a directory hierarchy
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl CcDdejLlMnPqrSUuWx
|
||||
.Op Fl bCcDdejLlMnPqrStUuWx
|
||||
.Op Fl i | Fl m
|
||||
.Op Fl E Ar tags
|
||||
.Op Fl F Ar flavor
|
||||
.Op Fl f Ar spec
|
||||
.Op Fl I Ar tags
|
||||
.Op Fl K Ar keywords
|
||||
.Op Fl k Ar keywords
|
||||
.Op Fl N Ar dbdir
|
||||
.Op Fl O Ar onlyfile
|
||||
.Op Fl p Ar path
|
||||
.Op Fl R Ar keywords
|
||||
.Op Fl s Ar seed
|
||||
@@ -92,6 +94,8 @@ missing from either the file hierarchy or the specification.
|
||||
.Pp
|
||||
The options are as follows:
|
||||
.Bl -tag -width Xxxexcludexfilexx
|
||||
.It Fl b
|
||||
Suppress blank lines before entering and after exiting directories.
|
||||
.It Fl C
|
||||
Convert a specification into
|
||||
a format that's easier to parse with various tools.
|
||||
@@ -140,6 +144,29 @@ and
|
||||
.It Fl e
|
||||
Don't complain about files that are in the file hierarchy, but not in the
|
||||
specification.
|
||||
.It Fl F Ar flavor
|
||||
Set the compatibility flavor of the
|
||||
.Nm
|
||||
utility.
|
||||
The
|
||||
.Ar flavor
|
||||
can be one of
|
||||
.Sy mtree ,
|
||||
.Sy freebsd9 ,
|
||||
or
|
||||
.Sy netbsd6 .
|
||||
The default is
|
||||
.Sy mtree .
|
||||
The
|
||||
.Sy freebsd9
|
||||
and
|
||||
.Sy netbsd6
|
||||
flavors attempt to preserve output compatiblity and command line option
|
||||
backward compatibility with
|
||||
.Fx 9.0
|
||||
and
|
||||
.Nx 6.0
|
||||
respectively.
|
||||
.It Fl f Ar spec
|
||||
Read the specification from
|
||||
.Ar file ,
|
||||
@@ -247,6 +274,8 @@ rather than using the results from the system's
|
||||
and
|
||||
.Xr getgrnam 3
|
||||
(and related) library calls.
|
||||
.It Fl O Ar onlypaths
|
||||
Only include files included in this list of pathnames.
|
||||
.It Fl P
|
||||
Don't follow symbolic links in the file hierarchy, instead consider
|
||||
the symbolic link itself in any comparisons.
|
||||
@@ -681,6 +710,35 @@ option can be used in combination with
|
||||
or
|
||||
.Fl u
|
||||
to create directory hierarchies for, for example, distributions.
|
||||
.Sh COMPATIBILITY
|
||||
The compatibility shims provided by the
|
||||
.Fl F
|
||||
option are incomplete by design.
|
||||
Known limitations are described below.
|
||||
.Pp
|
||||
The
|
||||
.Sy freebsd9
|
||||
flavor retains the default handling of lookup failures for the
|
||||
.Sy uname
|
||||
and
|
||||
.Sy group
|
||||
keywords by replacing them with appropriate
|
||||
.Sy uid
|
||||
and
|
||||
.Sy gid
|
||||
keywords rather than failing and reporting an error.
|
||||
The related
|
||||
.Fl w
|
||||
flag is a no-op rather than causing a warning to be printed and no
|
||||
keyword to be emitted.
|
||||
The latter behavior is not emulated as it is potentially dangerous in
|
||||
the face of /set statements.
|
||||
.Pp
|
||||
The
|
||||
.Sy netbsd6
|
||||
flavor does not replicate the historical bug that reported time as
|
||||
seconds.nanoseconds without zero padding nanosecond values less than
|
||||
100000000.
|
||||
.Sh SEE ALSO
|
||||
.Xr chflags 1 ,
|
||||
.Xr chgrp 1 ,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mtree.c,v 1.42 2012/10/05 09:18:08 wiz Exp $ */
|
||||
/* $NetBSD: mtree.c,v 1.48 2013/04/08 17:39:11 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1989, 1990, 1993
|
||||
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1990, 1993\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)mtree.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: mtree.c,v 1.42 2012/10/05 09:18:08 wiz Exp $");
|
||||
__RCSID("$NetBSD: mtree.c,v 1.48 2013/04/08 17:39:11 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -59,30 +59,45 @@ __RCSID("$NetBSD: mtree.c,v 1.42 2012/10/05 09:18:08 wiz Exp $");
|
||||
#include "extern.h"
|
||||
|
||||
int ftsoptions = FTS_PHYSICAL;
|
||||
int cflag, Cflag, dflag, Dflag, eflag, iflag, jflag, lflag, mflag,
|
||||
nflag, qflag, rflag, sflag, tflag, uflag, Uflag;
|
||||
int bflag, dflag, eflag, iflag, jflag, lflag, mflag, nflag, qflag, rflag,
|
||||
sflag, tflag, uflag;
|
||||
char fullpath[MAXPATHLEN];
|
||||
|
||||
static struct {
|
||||
enum flavor flavor;
|
||||
const char name[9];
|
||||
} flavors[] = {
|
||||
{F_MTREE, "mtree"},
|
||||
{F_FREEBSD9, "freebsd9"},
|
||||
{F_NETBSD6, "netbsd6"},
|
||||
};
|
||||
|
||||
__dead static void usage(void);
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int ch, status;
|
||||
unsigned int i;
|
||||
int cflag, Cflag, Dflag, Uflag, wflag;
|
||||
char *dir, *p;
|
||||
FILE *spec1, *spec2;
|
||||
|
||||
setprogname(argv[0]);
|
||||
|
||||
cflag = Cflag = Dflag = Uflag = wflag = 0;
|
||||
dir = NULL;
|
||||
init_excludes();
|
||||
spec1 = stdin;
|
||||
spec2 = NULL;
|
||||
|
||||
while ((ch = getopt(argc, argv,
|
||||
"cCdDeE:f:I:ik:K:lLmMnN:p:PqrR:s:StuUWxX:"))
|
||||
"bcCdDeE:f:F:I:ijk:K:lLmMnN:O:p:PqrR:s:StuUwWxX:"))
|
||||
!= -1) {
|
||||
switch((char)ch) {
|
||||
case 'b':
|
||||
bflag = 1;
|
||||
break;
|
||||
case 'c':
|
||||
cflag = 1;
|
||||
break;
|
||||
@@ -115,6 +130,15 @@ main(int argc, char **argv)
|
||||
} else
|
||||
usage();
|
||||
break;
|
||||
case 'F':
|
||||
for (i = 0; i < __arraycount(flavors); i++)
|
||||
if (strcmp(optarg, flavors[i].name) == 0) {
|
||||
flavor = flavors[i].flavor;
|
||||
break;
|
||||
}
|
||||
if (i == __arraycount(flavors))
|
||||
usage();
|
||||
break;
|
||||
case 'i':
|
||||
iflag = 1;
|
||||
break;
|
||||
@@ -157,6 +181,9 @@ main(int argc, char **argv)
|
||||
"Unable to use user and group databases in `%s'",
|
||||
optarg);
|
||||
break;
|
||||
case 'O':
|
||||
load_only(optarg);
|
||||
break;
|
||||
case 'p':
|
||||
dir = optarg;
|
||||
break;
|
||||
@@ -193,6 +220,9 @@ main(int argc, char **argv)
|
||||
case 'U':
|
||||
Uflag = uflag = 1;
|
||||
break;
|
||||
case 'w':
|
||||
wflag = 1;
|
||||
break;
|
||||
case 'W':
|
||||
mtree_Wflag = 1;
|
||||
break;
|
||||
@@ -213,6 +243,36 @@ main(int argc, char **argv)
|
||||
if (argc)
|
||||
usage();
|
||||
|
||||
switch (flavor) {
|
||||
case F_FREEBSD9:
|
||||
if (cflag && iflag) {
|
||||
warnx("-c and -i passed, replacing -i with -j for "
|
||||
"FreeBSD compatibility");
|
||||
iflag = 0;
|
||||
jflag = 1;
|
||||
}
|
||||
if (dflag && !bflag) {
|
||||
warnx("Adding -b to -d for FreeBSD compatibility");
|
||||
bflag = 1;
|
||||
}
|
||||
if (uflag && !iflag) {
|
||||
warnx("Adding -i to -%c for FreeBSD compatibility",
|
||||
Uflag ? 'U' : 'u');
|
||||
iflag = 1;
|
||||
}
|
||||
if (uflag && !tflag) {
|
||||
warnx("Adding -t to -%c for FreeBSD compatibility",
|
||||
Uflag ? 'U' : 'u');
|
||||
tflag = 1;
|
||||
}
|
||||
if (wflag)
|
||||
warnx("The -w flag is a no-op");
|
||||
break;
|
||||
default:
|
||||
if (wflag)
|
||||
usage();
|
||||
}
|
||||
|
||||
if (spec2 && (cflag || Cflag || Dflag))
|
||||
mtree_err("Double -f, -c, -C and -D flags are mutually "
|
||||
"exclusive");
|
||||
@@ -255,12 +315,18 @@ main(int argc, char **argv)
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
fprintf(stderr,
|
||||
"usage: %s [-CcDdejLlMnPqrSUuWx] [-i|-m] [-E tags]\n"
|
||||
"usage: %s [-bCcDdejLlMnPqrStUuWx] [-i|-m] [-E tags]\n"
|
||||
"\t\t[-f spec] [-f spec]\n"
|
||||
"\t\t[-I tags] [-K keywords] [-k keywords] [-N dbdir] [-p path]\n"
|
||||
"\t\t[-R keywords] [-s seed] [-X exclude-file]\n",
|
||||
"\t\t[-R keywords] [-s seed] [-X exclude-file]\n"
|
||||
"\t\t[-F flavor]\n",
|
||||
getprogname());
|
||||
fprintf(stderr, "\nflavors:");
|
||||
for (i = 0; i < __arraycount(flavors); i++)
|
||||
fprintf(stderr, " %s", flavors[i].name);
|
||||
fprintf(stderr, "\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
152
usr.sbin/mtree/only.c
Normal file
152
usr.sbin/mtree/only.c
Normal file
@@ -0,0 +1,152 @@
|
||||
/* $NetBSD: only.c,v 1.2 2013/02/05 00:59:03 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2013 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Christos Zoulas.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#if HAVE_NBTOOL_CONFIG_H
|
||||
#include "nbtool_config.h"
|
||||
#endif
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#if defined(__RCSID) && !defined(lint)
|
||||
__RCSID("$NetBSD: only.c,v 1.2 2013/02/05 00:59:03 christos Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
#include <time.h>
|
||||
#include <err.h>
|
||||
#include <util.h>
|
||||
|
||||
#include "extern.h"
|
||||
|
||||
struct hentry {
|
||||
char *str;
|
||||
uint32_t hash;
|
||||
struct hentry *next;
|
||||
};
|
||||
|
||||
static struct hentry *table[1024];
|
||||
static bool loaded;
|
||||
|
||||
static uint32_t
|
||||
hash_str(const char *str)
|
||||
{
|
||||
const uint8_t *s = (const uint8_t *)str;
|
||||
uint8_t c;
|
||||
uint32_t hash = 0;
|
||||
while ((c = *s++) != '\0')
|
||||
hash = hash * 33 + c; /* "perl": k=33, r=r+r/32 */
|
||||
return hash + (hash >> 5);
|
||||
}
|
||||
|
||||
static bool
|
||||
hash_find(const char *str, uint32_t *h)
|
||||
{
|
||||
struct hentry *e;
|
||||
*h = hash_str(str) % __arraycount(table);
|
||||
|
||||
for (e = table[*h]; e; e = e->next)
|
||||
if (e->hash == *h && strcmp(e->str, str) == 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
hash_insert(char *str, uint32_t h)
|
||||
{
|
||||
struct hentry *e;
|
||||
|
||||
if ((e = malloc(sizeof(*e))) == NULL)
|
||||
mtree_err("memory allocation error");
|
||||
|
||||
e->str = str;
|
||||
e->hash = h;
|
||||
e->next = table[h];
|
||||
table[h] = e;
|
||||
}
|
||||
|
||||
static void
|
||||
fill(char *str)
|
||||
{
|
||||
uint32_t h;
|
||||
char *ptr = strrchr(str, '/');
|
||||
|
||||
if (ptr == NULL)
|
||||
return;
|
||||
|
||||
*ptr = '\0';
|
||||
if (!hash_find(str, &h)) {
|
||||
char *x = strdup(str);
|
||||
if (x == NULL)
|
||||
mtree_err("memory allocation error");
|
||||
hash_insert(x, h);
|
||||
fill(str);
|
||||
}
|
||||
*ptr = '/';
|
||||
}
|
||||
|
||||
void
|
||||
load_only(const char *fname)
|
||||
{
|
||||
FILE *fp;
|
||||
char *line;
|
||||
size_t len, lineno;
|
||||
|
||||
if ((fp = fopen(fname, "r")) == NULL)
|
||||
err(1, "Cannot open `%s'", fname);
|
||||
|
||||
while ((line = fparseln(fp, &len, &lineno, NULL, FPARSELN_UNESCALL))) {
|
||||
uint32_t h;
|
||||
if (hash_find(line, &h))
|
||||
err(1, "Duplicate entry %s", line);
|
||||
hash_insert(line, h);
|
||||
fill(line);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
bool
|
||||
find_only(const char *path)
|
||||
{
|
||||
uint32_t h;
|
||||
|
||||
if (!loaded)
|
||||
return true;
|
||||
return hash_find(path, &h);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: spec.c,v 1.84 2012/10/07 18:40:49 christos Exp $ */
|
||||
/* $NetBSD: spec.c,v 1.88 2013/10/17 17:22:59 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1989, 1993
|
||||
@@ -67,7 +67,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)spec.c 8.2 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: spec.c,v 1.84 2012/10/07 18:40:49 christos Exp $");
|
||||
__RCSID("$NetBSD: spec.c,v 1.88 2013/10/17 17:22:59 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -81,6 +81,7 @@ __RCSID("$NetBSD: spec.c,v 1.84 2012/10/07 18:40:49 christos Exp $");
|
||||
#include <pwd.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
@@ -217,6 +218,12 @@ noparent: mtree_err("no parent node");
|
||||
/*
|
||||
* empty tree
|
||||
*/
|
||||
/*
|
||||
* Allow a bare "." root node by forcing it to
|
||||
* type=dir for compatibility with FreeBSD.
|
||||
*/
|
||||
if (strcmp(centry->name, ".") == 0 && centry->type == 0)
|
||||
centry->type = F_DIR;
|
||||
if (strcmp(centry->name, ".") != 0 ||
|
||||
centry->type != F_DIR)
|
||||
mtree_err(
|
||||
@@ -350,16 +357,18 @@ dump_nodes(const char *dir, NODE *root, int pathlast)
|
||||
appendfield(pathlast, "mode=%#o", cur->st_mode);
|
||||
if (MATCHFLAG(F_DEV) &&
|
||||
(cur->type == F_BLOCK || cur->type == F_CHAR))
|
||||
appendfield(pathlast, "device=%#llx", (long long)cur->st_rdev);
|
||||
appendfield(pathlast, "device=%#jx",
|
||||
(uintmax_t)cur->st_rdev);
|
||||
if (MATCHFLAG(F_NLINK))
|
||||
appendfield(pathlast, "nlink=%d", cur->st_nlink);
|
||||
if (MATCHFLAG(F_SLINK))
|
||||
appendfield(pathlast, "link=%s", vispath(cur->slink));
|
||||
if (MATCHFLAG(F_SIZE))
|
||||
appendfield(pathlast, "size=%lld", (long long)cur->st_size);
|
||||
appendfield(pathlast, "size=%ju",
|
||||
(uintmax_t)cur->st_size);
|
||||
if (MATCHFLAG(F_TIME))
|
||||
appendfield(pathlast, "time=%lld.%09ld",
|
||||
(long long)cur->st_mtimespec.tv_sec,
|
||||
appendfield(pathlast, "time=%jd.%09ld",
|
||||
(intmax_t)cur->st_mtimespec.tv_sec,
|
||||
cur->st_mtimespec.tv_nsec);
|
||||
if (MATCHFLAG(F_CKSUM))
|
||||
appendfield(pathlast, "cksum=%lu", cur->cksum);
|
||||
@@ -415,19 +424,16 @@ dump_nodes(const char *dir, NODE *root, int pathlast)
|
||||
char *
|
||||
vispath(const char *path)
|
||||
{
|
||||
const char extra[] = { ' ', '\t', '\n', '\\', '#',
|
||||
#ifdef notyet
|
||||
/*
|
||||
* We don't encode the globbing characters yet, because they
|
||||
* get encoded as \c and strunvis fails to decode them
|
||||
*/
|
||||
'*', '?', '[',
|
||||
#endif
|
||||
'\0' };
|
||||
static const char extra[] = { ' ', '\t', '\n', '\\', '#', '\0' };
|
||||
static const char extra_glob[] = { ' ', '\t', '\n', '\\', '#', '*',
|
||||
'?', '[', '\0' };
|
||||
static char pathbuf[4*MAXPATHLEN + 1];
|
||||
|
||||
strsvis(pathbuf, path, VIS_CSTYLE, extra);
|
||||
return(pathbuf);
|
||||
if (flavor == F_NETBSD6)
|
||||
strsvis(pathbuf, path, VIS_CSTYLE, extra);
|
||||
else
|
||||
strsvis(pathbuf, path, VIS_OCTAL, extra_glob);
|
||||
return pathbuf;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: verify.c,v 1.43 2012/10/05 01:31:05 christos Exp $ */
|
||||
/* $NetBSD: verify.c,v 1.44 2013/02/03 19:15:17 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
@@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)verify.c 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: verify.c,v 1.43 2012/10/05 01:31:05 christos Exp $");
|
||||
__RCSID("$NetBSD: verify.c,v 1.44 2013/02/03 19:15:17 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -95,6 +95,10 @@ vwalk(void)
|
||||
fts_set(t, p, FTS_SKIP);
|
||||
continue;
|
||||
}
|
||||
if (!find_only(p->fts_path)) {
|
||||
fts_set(t, p, FTS_SKIP);
|
||||
continue;
|
||||
}
|
||||
switch(p->fts_info) {
|
||||
case FTS_D:
|
||||
case FTS_SL:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# $NetBSD: postinstall,v 1.147 2012/09/22 09:20:06 ast Exp $
|
||||
# $NetBSD: postinstall,v 1.158 2013/09/09 15:04:12 prlw1 Exp $
|
||||
#
|
||||
# Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
|
||||
# All rights reserved.
|
||||
@@ -172,17 +172,18 @@ check_dir()
|
||||
return 0
|
||||
}
|
||||
|
||||
# check_ids op type file id [...]
|
||||
# check_ids op type file start id [...]
|
||||
# Check if file of type "users" or "groups" contains the relevant IDs
|
||||
# Returns 0 if ok, 1 otherwise.
|
||||
#
|
||||
check_ids()
|
||||
{
|
||||
[ $# -ge 4 ] || err 3 "USAGE: checks_ids op type file id [...]"
|
||||
[ $# -ge 5 ] || err 3 "USAGE: checks_ids op type file start id [...]"
|
||||
_op="$1"
|
||||
_type="$2"
|
||||
_file="$3"
|
||||
shift 3
|
||||
_start="$4"
|
||||
shift 4
|
||||
#_ids="$@"
|
||||
|
||||
if [ ! -f "${_file}" ]; then
|
||||
@@ -197,24 +198,33 @@ check_ids()
|
||||
if [ "${_op}" = "fix" ]; then
|
||||
_notfixed="${NOT_FIXED}"
|
||||
fi
|
||||
_missing="$(${AWK} -F: '
|
||||
_missing="$(${AWK} -v start=$_start -F: '
|
||||
BEGIN {
|
||||
for (x = 1; x < ARGC; x++)
|
||||
idlist[ARGV[x]]++
|
||||
for (x = 1; x < ARGC; x++) {
|
||||
if (ARGV[x] == "SKIP")
|
||||
continue;
|
||||
idlist[ARGV[x]]++;
|
||||
value[ARGV[x]] = start + x - 1;
|
||||
}
|
||||
ARGC=1
|
||||
}
|
||||
{
|
||||
found[$1]++
|
||||
number[$1] = $3
|
||||
}
|
||||
END {
|
||||
for (id in idlist) {
|
||||
if (! (id in found))
|
||||
print id
|
||||
if (!(id in found))
|
||||
printf("%s (missing)\n", id)
|
||||
else if (number[id] != value[id])
|
||||
printf("%s (%d != %d)\n", id,
|
||||
number[id], value[id])
|
||||
start++;
|
||||
}
|
||||
}
|
||||
' "$@" < "${_file}")" || return 1
|
||||
if [ -n "${_missing}" ]; then
|
||||
msg "Missing ${_type}${_notfixed}:" $(echo ${_missing})
|
||||
msg "Error ${_type}${_notfixed}:" $(echo ${_missing})
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
@@ -752,7 +762,7 @@ do_defaults()
|
||||
|
||||
compare_dir "$op" "${SRC_DIR}/etc/defaults" "${DEST_DIR}/etc/defaults" \
|
||||
444 \
|
||||
daily.conf monthly.conf security.conf \
|
||||
daily.conf monthly.conf pkgpath.conf security.conf \
|
||||
weekly.conf ${extra_scripts}
|
||||
failed=$(( ${failed} + $? ))
|
||||
|
||||
@@ -818,12 +828,56 @@ do_fontconfig()
|
||||
op="$1"
|
||||
failed=0
|
||||
|
||||
if [ -f "${DEST_DIR}/etc/fonts/conf.d/10-unhinted.conf" -a \
|
||||
-f "${DEST_DIR}/etc/fonts/conf.d/10-autohint.conf" ]; then
|
||||
failed=1
|
||||
# First, check for updates we can handle.
|
||||
if ! $SOURCEMODE; then
|
||||
FONTCONFIG_DIR="${SRC_DIR}/etc/fonts/conf.avail"
|
||||
else
|
||||
FONTCONFIG_DIR="${XSRC_DIR}/external/mit/fontconfig/dist/conf.d"
|
||||
fi
|
||||
|
||||
if [ "$failed" = 1 ]; then
|
||||
populate_dir "$op" false "${FONTCONFIG_DIR}" "${DEST_DIR}/etc/fonts/conf.avail" 444 \
|
||||
10-autohint.conf \
|
||||
10-no-sub-pixel.conf \
|
||||
10-scale-bitmap-fonts.conf \
|
||||
10-sub-pixel-bgr.conf \
|
||||
10-sub-pixel-rgb.conf \
|
||||
10-sub-pixel-vbgr.conf \
|
||||
10-sub-pixel-vrgb.conf \
|
||||
10-unhinted.conf \
|
||||
11-lcdfilter-default.conf \
|
||||
11-lcdfilter-legacy.conf \
|
||||
11-lcdfilter-light.conf \
|
||||
20-unhint-small-vera.conf \
|
||||
25-unhint-nonlatin.conf \
|
||||
30-metric-aliases.conf \
|
||||
30-urw-aliases.conf \
|
||||
40-nonlatin.conf \
|
||||
45-latin.conf \
|
||||
49-sansserif.conf \
|
||||
50-user.conf \
|
||||
51-local.conf \
|
||||
60-latin.conf \
|
||||
65-fonts-persian.conf \
|
||||
65-khmer.conf \
|
||||
65-nonlatin.conf \
|
||||
69-unifont.conf \
|
||||
70-no-bitmaps.conf \
|
||||
70-yes-bitmaps.conf \
|
||||
80-delicious.conf \
|
||||
90-synthetic.conf
|
||||
failed=$(( ${failed} + $? ))
|
||||
|
||||
# We can't modify conf.d easily; someone might have removed a file.
|
||||
|
||||
conf_d_failed=0
|
||||
# Look for old files that need to be deleted.
|
||||
if [ -f "${DEST_DIR}/etc/fonts/conf.d/10-unhinted.conf" -a \
|
||||
-f "${DEST_DIR}/etc/fonts/conf.d/10-autohint.conf" ]; then
|
||||
conf_d_failed=1
|
||||
failed=$(( ${failed} + 1 ))
|
||||
fi
|
||||
|
||||
if [ "$conf_d_failed" = 1 ]; then
|
||||
msg \
|
||||
"Broken fontconfig configuration found; please delete these files"
|
||||
msg \
|
||||
@@ -853,9 +907,9 @@ do_gid()
|
||||
{
|
||||
[ -n "$1" ] || err 3 "USAGE: do_gid fix|check"
|
||||
|
||||
check_ids "$1" groups "${DEST_DIR}/etc/group" \
|
||||
named ntpd sshd authpf _pflogd _rwhod _proxy _timedc \
|
||||
_sdpd _httpd _mdnsd _tests _tcpdump _tss
|
||||
check_ids "$1" groups "${DEST_DIR}/etc/group" 14 \
|
||||
named ntpd sshd SKIP _pflogd _rwhod staff _proxy _timedc \
|
||||
_sdpd _httpd _mdnsd _tests _tcpdump _tss _gpio _rtadvd
|
||||
}
|
||||
|
||||
#
|
||||
@@ -998,7 +1052,7 @@ do_mtree()
|
||||
if ! $SOURCEMODE; then
|
||||
MTREE_DIR="${SRC_DIR}/etc/mtree"
|
||||
else
|
||||
${MAKE} -C "${SRC_DIR}/etc/mtree" emit_dist_file > \
|
||||
${MAKE} -s -C "${SRC_DIR}/etc/mtree" emit_dist_file > \
|
||||
"${SCRATCHDIR}/NetBSD.dist"
|
||||
MTREE_DIR="${SCRATCHDIR}"
|
||||
fi
|
||||
@@ -1150,7 +1204,7 @@ do_rc()
|
||||
DAEMON DISKS LOGIN NETWORKING SERVERS \
|
||||
accounting altqd amd apmd \
|
||||
bluetooth bootconf.sh bootparams \
|
||||
ccd cgd cleartmp cron \
|
||||
ccd cgd cleartmp cron devpubd \
|
||||
dhclient dhcpcd dhcpd dhcrelay dmesg downinterfaces envsys \
|
||||
fsck fsck_root ftp_proxy ftpd \
|
||||
gpio \
|
||||
@@ -1158,16 +1212,16 @@ do_rc()
|
||||
identd ifwatchd inetd ipfilter ipfs ipmon ipnat ipsec \
|
||||
irdaattach iscsi_target isdnd isibootd \
|
||||
kdc \
|
||||
ldconfig ldpd local lpd lvm\
|
||||
ldconfig ldpd local lpd lvm \
|
||||
makemandb mdnsd mixerctl mopd motd mountall mountcritlocal \
|
||||
mountcritremote mountd moused mrouted \
|
||||
named ndbootd network newsyslog nfsd nfslocking npf \
|
||||
ntpd ntpdate \
|
||||
named ndbootd network newsyslog nfsd nfslocking npf ntpd \
|
||||
ntpdate \
|
||||
perusertmp pf pf_boot pflogd postfix powerd ppp pwcheck \
|
||||
quota \
|
||||
racoon rpcbind raidframe raidframeparity random_seed \
|
||||
rarpd rbootd rndctl \
|
||||
root route6d routed rtadvd rtclocaltime rtsold rwho \
|
||||
racoon rpcbind raidframe raidframeparity random_seed rarpd \
|
||||
rbootd rndctl root route6d routed rtadvd rtclocaltime \
|
||||
rtsold rwho \
|
||||
savecore screenblank securelevel sshd \
|
||||
staticroute swap1 swap2 sysctl sysdb syslogd \
|
||||
timed tpctl ttys \
|
||||
@@ -1529,9 +1583,9 @@ do_uid()
|
||||
{
|
||||
[ -n "$1" ] || err 3 "USAGE: do_uid fix|check"
|
||||
|
||||
check_ids "$1" users "${DEST_DIR}/etc/master.passwd" \
|
||||
named ntpd postfix sshd _pflogd _rwhod _proxy _timedc \
|
||||
_sdpd _httpd _mdnsd _tests _tcpdump _tss
|
||||
check_ids "$1" users "${DEST_DIR}/etc/master.passwd" 12 \
|
||||
postfix SKIP named ntpd sshd SKIP _pflogd _rwhod SKIP _proxy \
|
||||
_timedc _sdpd _httpd _mdnsd _tests _tcpdump _tss SKIP _rtadvd
|
||||
}
|
||||
|
||||
|
||||
@@ -1818,7 +1872,7 @@ do_ptyfsoldnodes()
|
||||
usage()
|
||||
{
|
||||
cat 1>&2 << _USAGE_
|
||||
Usage: ${PROGNAME} [-s srcdir] [-d destdir] [-m mach] [-a arch] op [item [...]]
|
||||
Usage: ${PROGNAME} [-s srcdir] [-x xsrcdir] [-d destdir] [-m mach] [-a arch] op [item [...]]
|
||||
Perform post-installation checks and/or fixes on a system's
|
||||
configuration files.
|
||||
If no items are provided, a default set of checks or fixes is applied.
|
||||
@@ -1833,7 +1887,10 @@ Usage: ${PROGNAME} [-s srcdir] [-d destdir] [-m mach] [-a arch] op [item [...]]
|
||||
multiple such files;
|
||||
* A temporary directory in which one or both of
|
||||
"etc.tgz" and "xetc.tgz" have been extracted.
|
||||
[${SRC_DIR:-/}]
|
||||
[${SRC_DIR:-/usr/src}]
|
||||
-x xsrcdir Location of the X11 source files. This must be
|
||||
a directory that contains a NetBSD xsrc tree.
|
||||
[${XSRC_DIR:-/usr/src/../xsrc}]
|
||||
-d destdir Destination directory to check. [${DEST_DIR:-/}]
|
||||
-m mach MACHINE. [${MACHINE}]
|
||||
-a arch MACHINE_ARCH. [${MACHINE_ARCH}]
|
||||
@@ -1876,12 +1933,13 @@ main()
|
||||
TGZLIST= # quoted list list of tgz files
|
||||
SRC_ARGLIST= # quoted list of one or more "-s" args
|
||||
SRC_DIR="${SRC_ARG}" # set default value for early usage()
|
||||
XSRC_DIR="${SRC_ARG}/../xsrc"
|
||||
N_SRC_ARGS=0 # number of "-s" args
|
||||
TGZMODE=false # true if "-s" specifies a tgz file
|
||||
DIRMODE=false # true if "-s" specified a directory
|
||||
SOURCEMODE=false # true if "-s" specified a source directory
|
||||
|
||||
while getopts s:d:m:a: ch; do
|
||||
while getopts s:x:d:m:a: ch; do
|
||||
case "${ch}" in
|
||||
s)
|
||||
qarg="$(shell_quote "${OPTARG}")"
|
||||
@@ -1912,6 +1970,14 @@ main()
|
||||
err 2 "Invalid argument for -s option"
|
||||
fi
|
||||
;;
|
||||
x)
|
||||
if [ -d "${OPTARG}" ]; then
|
||||
# arg refers to a directory.
|
||||
XSRC_DIR="${OPTARG}"
|
||||
else
|
||||
err 2 "Not a directory for -x option"
|
||||
fi
|
||||
;;
|
||||
d)
|
||||
DEST_DIR="${OPTARG}"
|
||||
;;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pwd_mkdb.c,v 1.53 2011/01/04 10:01:51 wiz Exp $ */
|
||||
/* $NetBSD: pwd_mkdb.c,v 1.56 2012/11/26 20:13:54 pooka Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000, 2009 The NetBSD Foundation, Inc.
|
||||
@@ -90,7 +90,7 @@ __COPYRIGHT("@(#) Copyright (c) 2000, 2009\
|
||||
The NetBSD Foundation, Inc. All rights reserved.\
|
||||
Copyright (c) 1991, 1993, 1994\
|
||||
The Regents of the University of California. All rights reserved.");
|
||||
__RCSID("$NetBSD: pwd_mkdb.c,v 1.53 2011/01/04 10:01:51 wiz Exp $");
|
||||
__RCSID("$NetBSD: pwd_mkdb.c,v 1.56 2012/11/26 20:13:54 pooka Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#if HAVE_NBTOOL_CONFIG_H
|
||||
@@ -119,7 +119,10 @@ __RCSID("$NetBSD: pwd_mkdb.c,v 1.53 2011/01/04 10:01:51 wiz Exp $");
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef HAVE_NBTOOL_CONFIG_H
|
||||
#include <util.h>
|
||||
#endif
|
||||
|
||||
#define MAX_CACHESIZE 8*1024*1024
|
||||
#define MIN_CACHESIZE 2*1024*1024
|
||||
@@ -167,13 +170,13 @@ static int warning;
|
||||
static struct pwddb sdb, idb;
|
||||
|
||||
|
||||
void bailout(void) __attribute__((__noreturn__));
|
||||
void bailout(void) __dead;
|
||||
void cp(const char *, const char *, mode_t);
|
||||
void deldbent(struct pwddb *, int, void *);
|
||||
void mkpw_error(const char *, ...);
|
||||
void mkpw_error(const char *, ...) __dead;
|
||||
void mkpw_warning(const char *, ...);
|
||||
int getdbent(struct pwddb *, int, void *, struct passwd **);
|
||||
void inconsistency(void);
|
||||
void inconsistency(void) __dead;
|
||||
void install(const char *, const char *);
|
||||
int main(int, char **);
|
||||
void putdbents(struct pwddb *, struct passwd *, const char *, int, int,
|
||||
@@ -181,8 +184,8 @@ void putdbents(struct pwddb *, struct passwd *, const char *, int, int,
|
||||
void putyptoken(struct pwddb *);
|
||||
void rm(const char *);
|
||||
int scan(FILE *, struct passwd *, int *, int *);
|
||||
void usage(void) __attribute__((__noreturn__));
|
||||
void wr_error(const char *);
|
||||
void usage(void) __dead;
|
||||
void wr_error(const char *) __dead;
|
||||
uint32_t getversion(const char *);
|
||||
void setversion(struct pwddb *);
|
||||
|
||||
@@ -345,7 +348,7 @@ main(int argc, char *argv[])
|
||||
(void)sigaddset(&set, SIGINT);
|
||||
(void)sigaddset(&set, SIGQUIT);
|
||||
(void)sigaddset(&set, SIGTERM);
|
||||
(void)sigprocmask(SIG_BLOCK, &set, (sigset_t *)NULL);
|
||||
(void)sigprocmask(SIG_BLOCK, &set, NULL);
|
||||
|
||||
/* We don't care what the user wants. */
|
||||
(void)umask(0);
|
||||
@@ -436,7 +439,7 @@ main(int argc, char *argv[])
|
||||
* Create original format password file entry.
|
||||
*/
|
||||
if (makeold) {
|
||||
#ifdef __minix
|
||||
#if defined(__minix)
|
||||
(void)fprintf(oldfp, "%s:##%s:%d:%d:%s:%s:%s\n",
|
||||
pwd.pw_name, pwd.pw_name, pwd.pw_uid, pwd.pw_gid,
|
||||
pwd.pw_gecos, pwd.pw_dir, pwd.pw_shell);
|
||||
@@ -444,7 +447,7 @@ main(int argc, char *argv[])
|
||||
(void)fprintf(oldfp, "%s:*:%d:%d:%s:%s:%s\n",
|
||||
pwd.pw_name, pwd.pw_uid, pwd.pw_gid, pwd.pw_gecos,
|
||||
pwd.pw_dir, pwd.pw_shell);
|
||||
#endif
|
||||
#endif /* defined(__minix) */
|
||||
if (ferror(oldfp))
|
||||
wr_error(oldpwdfile);
|
||||
}
|
||||
@@ -1046,7 +1049,7 @@ putyptoken(struct pwddb *db)
|
||||
|
||||
key.data = __UNCONST(__yp_token);
|
||||
key.size = strlen(__yp_token);
|
||||
data.data = (u_char *)NULL;
|
||||
data.data = NULL;
|
||||
data.size = 0;
|
||||
|
||||
if ((*db->db->put)(db->db, &key, &data, R_NOOVERWRITE) == -1)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: user.c,v 1.129 2011/12/01 00:34:05 dholland Exp $ */
|
||||
/* $NetBSD: user.c,v 1.131 2012/11/28 11:31:27 blymn Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 Alistair G. Crooks. All rights reserved.
|
||||
@@ -33,7 +33,7 @@
|
||||
#ifndef lint
|
||||
__COPYRIGHT("@(#) Copyright (c) 1999\
|
||||
The NetBSD Foundation, Inc. All rights reserved.");
|
||||
__RCSID("$NetBSD: user.c,v 1.129 2011/12/01 00:34:05 dholland Exp $");
|
||||
__RCSID("$NetBSD: user.c,v 1.131 2012/11/28 11:31:27 blymn Exp $");
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -142,7 +142,6 @@ enum {
|
||||
#define LOCK 1
|
||||
#define LOCKED "*LOCKED*"
|
||||
|
||||
|
||||
#ifndef DEF_GROUP
|
||||
#define DEF_GROUP "users"
|
||||
#endif
|
||||
@@ -152,12 +151,12 @@ enum {
|
||||
#endif
|
||||
|
||||
#ifndef DEF_SKELDIR
|
||||
#ifdef __minix
|
||||
#if defined(__minix)
|
||||
#define DEF_SKELDIR "/usr/ast"
|
||||
#else
|
||||
#define DEF_SKELDIR "/etc/skel"
|
||||
#endif
|
||||
#endif
|
||||
#endif /* defined(__minix) */
|
||||
|
||||
#ifndef DEF_SHELL
|
||||
#define DEF_SHELL _PATH_BSHELL
|
||||
@@ -211,7 +210,6 @@ enum {
|
||||
DES_Len = 13,
|
||||
};
|
||||
|
||||
|
||||
#define UNSET_INACTIVE "Null (unset)"
|
||||
#define UNSET_EXPIRY "Null (unset)"
|
||||
|
||||
@@ -1582,9 +1580,15 @@ moduser(char *login_name, char *newlogin, user_t *up, int allow_samba)
|
||||
errx(EXIT_FAILURE,
|
||||
"Can't modify user `%s': "
|
||||
"gid %d is already in use",
|
||||
login_name, up->u_uid);
|
||||
login_name, pwp->pw_uid);
|
||||
}
|
||||
pwp->pw_gid = pwp->pw_uid;
|
||||
if (!creategid(newlogin, pwp->pw_uid, "")) {
|
||||
errx(EXIT_FAILURE,
|
||||
"Could not create group %s "
|
||||
"with uid %d", newlogin,
|
||||
up->u_uid);
|
||||
}
|
||||
} else if ((grp = getgrnam(up->u_primgrp)) != NULL) {
|
||||
pwp->pw_gid = grp->gr_gid;
|
||||
} else if (is_number(up->u_primgrp) &&
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: vipw.8,v 1.15 2005/09/05 03:37:15 hubertf Exp $
|
||||
.\" $NetBSD: vipw.8,v 1.16 2012/04/08 22:00:41 wiz Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1983, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@@ -37,9 +37,7 @@
|
||||
.Nd edit the password file
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Bk -words
|
||||
.Op Fl d Ar directory
|
||||
.Ek
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
edits the password file after setting the appropriate locks,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vipw.c,v 1.14 2009/04/19 00:44:49 lukem Exp $ */
|
||||
/* $NetBSD: vipw.c,v 1.16 2011/08/31 16:25:00 plunky Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1993, 1994
|
||||
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993, 1994\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)vipw.c 8.3 (Berkeley) 4/2/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: vipw.c,v 1.14 2009/04/19 00:44:49 lukem Exp $");
|
||||
__RCSID("$NetBSD: vipw.c,v 1.16 2011/08/31 16:25:00 plunky Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -57,11 +57,10 @@ __RCSID("$NetBSD: vipw.c,v 1.14 2009/04/19 00:44:49 lukem Exp $");
|
||||
#include <errno.h>
|
||||
#include <util.h>
|
||||
|
||||
int main __P((int, char **));
|
||||
static void copyfile __P((int, int));
|
||||
static void usage __P((void));
|
||||
static void copyfile(int, int);
|
||||
__dead static void usage(void);
|
||||
|
||||
char mpwd[MAXPATHLEN], mpwdl[MAXPATHLEN];
|
||||
static char mpwd[MAXPATHLEN], mpwdl[MAXPATHLEN];
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
@@ -118,7 +117,7 @@ main(int argc, char *argv[])
|
||||
if (begin.st_mtime == end.st_mtime &&
|
||||
begin.st_mtimensec == end.st_mtimensec) {
|
||||
warnx("no changes made");
|
||||
pw_error((char *)NULL, 0, 0);
|
||||
pw_error(NULL, 0, 0);
|
||||
}
|
||||
if (pw_mkdb(NULL, 0) == 0)
|
||||
break;
|
||||
|
||||
@@ -69,13 +69,15 @@
|
||||
.Nd configure vnode disks
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl Scrv
|
||||
.Op Fl crvz
|
||||
.Op Fl f Ar disktab
|
||||
.Op Fl t Ar typename
|
||||
.Ar vnode_disk
|
||||
.Ar regular_file
|
||||
.Op Ar geomspec
|
||||
.Nm
|
||||
.Fl u
|
||||
.Op Fl SFv
|
||||
.Op Fl Fv
|
||||
.Ar vnode_disk
|
||||
.Nm
|
||||
.Fl l
|
||||
@@ -118,7 +120,7 @@ argument is:
|
||||
.Sm on
|
||||
.Ed
|
||||
.Pp
|
||||
If geometry is not specified, the driver will choose a default based on 1MB
|
||||
If geometry is not specified, the kernel will choose a default based on 1MB
|
||||
cylinders.
|
||||
.Ar secsize
|
||||
is the number of bytes per sector.
|
||||
@@ -129,39 +131,65 @@ is the number of sectors per track.
|
||||
is the number of tracks per cylinder.
|
||||
.Ar ncylinders
|
||||
is the number of cylinders in the device.
|
||||
.It Fl S
|
||||
Do not start or stop the corresponding device driver instance.
|
||||
.It Fl F
|
||||
Force unconfiguration if the device is in use.
|
||||
Does not imply
|
||||
.Fl u .
|
||||
.It Fl f Ar disktab
|
||||
Specifies that the
|
||||
.Fl t
|
||||
option should look up in
|
||||
.Ar disktab
|
||||
instead of in
|
||||
.Pa /etc/disktab .
|
||||
.It Fl l
|
||||
List the vnd devices and indicate which ones are in use.
|
||||
If a specific
|
||||
.Ar vnode_disk
|
||||
is given, then only that will be described.
|
||||
.It Fl t Ar typename
|
||||
If configuring the device, look up
|
||||
.Ar typename
|
||||
in
|
||||
.Pa /etc/disktab
|
||||
and use the geometry specified in the entry.
|
||||
This option and the
|
||||
.Ar geomspec
|
||||
argument are mutually exclusive.
|
||||
.It Fl r
|
||||
Configure the device as read-only.
|
||||
.It Fl u
|
||||
Unconfigures the device.
|
||||
.It Fl v
|
||||
Print messages to stdout describing actions taken.
|
||||
.It Fl z
|
||||
Assume that
|
||||
.Ar regular_file
|
||||
is a compressed disk image in cloop2 format, and configure it
|
||||
read-only.
|
||||
See the
|
||||
.Xr vndcompress 1
|
||||
manpage on how to create such an image.
|
||||
.El
|
||||
.Pp
|
||||
If no action option is given,
|
||||
.Fl c
|
||||
is assumed.
|
||||
.Sh FILES
|
||||
.Bl -tag -width /dev/vnd* -compact
|
||||
.It Pa /dev/vnd*
|
||||
.Bl -tag -width /etc/disktab -compact
|
||||
.It Pa /dev/rvnd??
|
||||
.It Pa /dev/vnd??
|
||||
.It Pa /etc/disktab
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
.Dl vndconfig vnd0 /tmp/diskimage
|
||||
or
|
||||
.Dl vndconfig /dev/vnd0 /tmp/diskimage
|
||||
.Dl vndconfig /dev/rvnd0c /tmp/diskimage
|
||||
.Pp
|
||||
Configures the vnode disk
|
||||
.Pa vnd0 .
|
||||
Please note that use of the second form of the command is discouraged because
|
||||
it requires knowledge of the raw partition which varies between architectures.
|
||||
.Pp
|
||||
.Dl vndconfig vnd0 /tmp/floppy.img 512/18/2/80
|
||||
.Pp
|
||||
@@ -170,26 +198,32 @@ Configures the vnode disk
|
||||
emulating the geometry of 512 bytes per sector, 18 sectors per track,
|
||||
2 tracks per cylinder, and 80 cylinders total.
|
||||
.Pp
|
||||
.Dl vndconfig -t floppy vnd0 /tmp/floppy.img
|
||||
.Pp
|
||||
Configures the vnode disk
|
||||
.Pa vnd0
|
||||
using the geometry specified in the
|
||||
.Pa floppy
|
||||
entry in
|
||||
.Pa /etc/disktab .
|
||||
.Pp
|
||||
.Dl vndconfig -u vnd0
|
||||
.Pp
|
||||
Unconfigures the
|
||||
.Pa vnd0
|
||||
device.
|
||||
.Sh NOTES
|
||||
If
|
||||
.Ic vnconfig -uF
|
||||
is used and the device was still in use, the driver instance
|
||||
will not be shut down, even if
|
||||
.Fl S
|
||||
was not given. One may manually shut down
|
||||
the service later with
|
||||
.Ic service down
|
||||
.Ar vndN
|
||||
where
|
||||
.Ar N
|
||||
is the instance number, or simply
|
||||
leave the driver running for later reuse.
|
||||
.Sh SEE ALSO
|
||||
.Xr vndcompress 1 ,
|
||||
.Xr opendisk 3 ,
|
||||
.Xr vnd 4 ,
|
||||
.Xr mount 8 ,
|
||||
.Xr swapctl 8 ,
|
||||
.Xr umount 8
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
command appeared in
|
||||
.Nx 1.0 .
|
||||
.Sh BUGS
|
||||
This command should really be named
|
||||
.Nm vndconfig .
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
#include <sys/param.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mount.h>
|
||||
#ifndef __minix
|
||||
#if !defined(__minix)
|
||||
#include <sys/buf.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/disk.h>
|
||||
@@ -78,7 +78,7 @@
|
||||
#else
|
||||
#include <minix/paths.h>
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
#endif /* !defined(__minix) */
|
||||
|
||||
#include <dev/vndvar.h>
|
||||
|
||||
@@ -104,20 +104,20 @@ static int readonly = 0;
|
||||
static int force = 0;
|
||||
static int compressed = 0;
|
||||
static char *tabname;
|
||||
#ifdef __minix
|
||||
#if defined(__minix)
|
||||
static int service = 1;
|
||||
#endif
|
||||
#endif /* defined(__minix) */
|
||||
|
||||
#ifndef __minix
|
||||
#if !defined(__minix)
|
||||
static void show(int, int);
|
||||
#else
|
||||
static void show(const char *, int);
|
||||
#endif
|
||||
#endif /* !defined(__minix) */
|
||||
static int config(char *, char *, char *, int);
|
||||
static int getgeom(struct vndgeom *, char *);
|
||||
__dead static void usage(void);
|
||||
|
||||
#ifdef __minix
|
||||
#if defined(__minix)
|
||||
/*
|
||||
* Start a driver instance for the given vnd name. The return value indicates
|
||||
* whether the instance has been started successfully.
|
||||
@@ -189,25 +189,25 @@ stop_service(int fd, char *dev)
|
||||
system(cmd);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* defined(__minix) */
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
int ch, rv, action = VND_CONFIG;
|
||||
|
||||
#ifndef __minix
|
||||
#if !defined(__minix)
|
||||
while ((ch = getopt(argc, argv, "Fcf:lrt:uvz")) != -1) {
|
||||
#else
|
||||
/* MINIX3: added -S; no support for -f, -t, -z at this time. */
|
||||
while ((ch = getopt(argc, argv, "SFclruv")) != -1) {
|
||||
#endif
|
||||
#endif /* !defined(__minix) */
|
||||
switch (ch) {
|
||||
#ifdef __minix
|
||||
#if defined(__minix)
|
||||
case 'S':
|
||||
service = 0;
|
||||
break;
|
||||
#endif
|
||||
#endif /* defined(__minix) */
|
||||
case 'F':
|
||||
force = 1;
|
||||
break;
|
||||
@@ -215,10 +215,10 @@ main(int argc, char *argv[])
|
||||
action = VND_CONFIG;
|
||||
break;
|
||||
case 'f':
|
||||
#ifndef __minix
|
||||
#if !defined(__minix)
|
||||
if (setdisktab(optarg) == -1)
|
||||
usage();
|
||||
#endif
|
||||
#endif /* !defined(__minix) */
|
||||
break;
|
||||
case 'l':
|
||||
action = VND_GET;
|
||||
@@ -259,47 +259,47 @@ main(int argc, char *argv[])
|
||||
usage();
|
||||
rv = config(argv[0], NULL, NULL, action);
|
||||
} else { /* VND_GET */
|
||||
#ifndef __minix
|
||||
#if !defined(__minix)
|
||||
int n, v;
|
||||
const char *vn;
|
||||
char path[64];
|
||||
#else
|
||||
int n;
|
||||
#endif
|
||||
#endif /* !defined(__minix) */
|
||||
|
||||
if (argc != 0 && argc != 1)
|
||||
usage();
|
||||
|
||||
#ifndef __minix
|
||||
#if !defined(__minix)
|
||||
vn = argc ? argv[0] : "vnd0";
|
||||
|
||||
v = opendisk(vn, O_RDONLY, path, sizeof(path), 0);
|
||||
if (v == -1)
|
||||
err(1, "open: %s", vn);
|
||||
#endif
|
||||
#endif /* !defined(__minix) */
|
||||
|
||||
if (argc)
|
||||
#ifndef __minix
|
||||
#if !defined(__minix)
|
||||
show(v, -1);
|
||||
#else
|
||||
show(argv[0], -1);
|
||||
#endif
|
||||
#endif /* !defined(__minix) */
|
||||
else {
|
||||
DIR *dirp;
|
||||
struct dirent *dp;
|
||||
#ifndef __minix
|
||||
#if !defined(__minix)
|
||||
__BITMAP_TYPE(, uint32_t, 65536) bm;
|
||||
|
||||
__BITMAP_ZERO(&bm);
|
||||
#else
|
||||
char *endp;
|
||||
#endif
|
||||
#endif /* !defined(__minix) */
|
||||
|
||||
if ((dirp = opendir(_PATH_DEV)) == NULL)
|
||||
err(1, "opendir: %s", _PATH_DEV);
|
||||
|
||||
while ((dp = readdir(dirp)) != NULL) {
|
||||
#ifndef __minix
|
||||
#if !defined(__minix)
|
||||
if (strncmp(dp->d_name, "rvnd", 4) != 0)
|
||||
continue;
|
||||
n = atoi(dp->d_name + 4);
|
||||
@@ -314,31 +314,31 @@ main(int argc, char *argv[])
|
||||
if (endp[0])
|
||||
continue;
|
||||
show(dp->d_name, n);
|
||||
#endif
|
||||
#endif /* !defined(__minix) */
|
||||
}
|
||||
|
||||
closedir(dirp);
|
||||
}
|
||||
#ifndef __minix
|
||||
#if !defined(__minix)
|
||||
close(v);
|
||||
#endif
|
||||
#endif /* !defined(__minix) */
|
||||
rv = 0;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
static void
|
||||
#ifndef __minix
|
||||
#if !defined(__minix)
|
||||
show(int v, int n)
|
||||
#else
|
||||
show(const char *vn, int n)
|
||||
#endif
|
||||
#endif /* !defined(__minix) */
|
||||
{
|
||||
struct vnd_user vnu;
|
||||
char *dev;
|
||||
struct statvfs *mnt;
|
||||
int i, nmount;
|
||||
#ifdef __minix
|
||||
#if defined(__minix)
|
||||
int v;
|
||||
char path[PATH_MAX];
|
||||
|
||||
@@ -350,15 +350,15 @@ show(const char *vn, int n)
|
||||
printf("vnd%d: not in use\n", n);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif /* defined(__minix) */
|
||||
|
||||
vnu.vnu_unit = n;
|
||||
if (ioctl(v, VNDIOCGET, &vnu) == -1)
|
||||
err(1, "VNDIOCGET");
|
||||
|
||||
#ifdef __minix
|
||||
#if defined(__minix)
|
||||
close(v);
|
||||
#endif
|
||||
#endif /* defined(__minix) */
|
||||
|
||||
if (vnu.vnu_ino == 0) {
|
||||
printf("vnd%d: not in use\n", vnu.vnu_unit);
|
||||
@@ -401,15 +401,15 @@ static int
|
||||
config(char *dev, char *file, char *geom, int action)
|
||||
{
|
||||
struct vnd_ioctl vndio;
|
||||
#ifndef __minix
|
||||
#if !defined(__minix)
|
||||
struct disklabel *lp;
|
||||
#else
|
||||
int stop = 0;
|
||||
#endif
|
||||
#endif /* !defined(__minix) */
|
||||
char rdev[MAXPATHLEN + 1];
|
||||
int fd, rv;
|
||||
|
||||
#ifdef __minix
|
||||
#if defined(__minix)
|
||||
/*
|
||||
* MINIX does not have the concept of raw devices. As such, the access
|
||||
* checks that apply to opening block devices, automatically apply here
|
||||
@@ -426,7 +426,7 @@ config(char *dev, char *file, char *geom, int action)
|
||||
}
|
||||
#else
|
||||
fd = opendisk(dev, O_RDWR, rdev, sizeof(rdev), 0);
|
||||
#endif
|
||||
#endif /* defined(__minix) */
|
||||
if (fd < 0) {
|
||||
warn("%s: opendisk", rdev);
|
||||
return (1);
|
||||
@@ -437,19 +437,19 @@ config(char *dev, char *file, char *geom, int action)
|
||||
rv = 0; /* XXX */
|
||||
#endif
|
||||
|
||||
#ifndef __minix
|
||||
#if !defined(__minix)
|
||||
vndio.vnd_file = file;
|
||||
#endif
|
||||
#endif /* !defined(__minix) */
|
||||
if (geom != NULL) {
|
||||
rv = getgeom(&vndio.vnd_geom, geom);
|
||||
#ifdef __minix
|
||||
#if defined(__minix)
|
||||
if (rv && stop)
|
||||
stop_service(fd, rdev);
|
||||
#endif
|
||||
#endif /* !defined(__minix) */
|
||||
if (rv != 0)
|
||||
errx(1, "invalid geometry: %s", geom);
|
||||
vndio.vnd_flags = VNDIOF_HASGEOM;
|
||||
#ifndef __minix
|
||||
#if !defined(__minix)
|
||||
} else if (tabname != NULL) {
|
||||
lp = getdiskbyname(tabname);
|
||||
if (lp == NULL)
|
||||
@@ -459,16 +459,16 @@ config(char *dev, char *file, char *geom, int action)
|
||||
vndio.vnd_geom.vng_ntracks = lp->d_ntracks;
|
||||
vndio.vnd_geom.vng_ncylinders = lp->d_ncylinders;
|
||||
vndio.vnd_flags = VNDIOF_HASGEOM;
|
||||
#endif
|
||||
#endif /* !defined(__minix) */
|
||||
}
|
||||
|
||||
if (readonly)
|
||||
vndio.vnd_flags |= VNDIOF_READONLY;
|
||||
|
||||
#ifndef __minix
|
||||
#if !defined(__minix)
|
||||
if (compressed)
|
||||
vndio.vnd_flags |= VNF_COMP;
|
||||
#endif
|
||||
#endif /* !defined(__minix) */
|
||||
|
||||
/*
|
||||
* Clear (un-configure) the device
|
||||
@@ -485,10 +485,10 @@ config(char *dev, char *file, char *geom, int action)
|
||||
warn("%s: VNDIOCCLR", rdev);
|
||||
else if (verbose)
|
||||
printf("%s: cleared\n", rdev);
|
||||
#ifdef __minix
|
||||
#if defined(__minix)
|
||||
if (!rv && service)
|
||||
stop = 2;
|
||||
#endif
|
||||
#endif /* defined(__minix) */
|
||||
}
|
||||
/*
|
||||
* Configure the device
|
||||
@@ -500,11 +500,11 @@ config(char *dev, char *file, char *geom, int action)
|
||||
if (ffd < 0)
|
||||
warn("%s", file);
|
||||
else {
|
||||
#ifndef __minix
|
||||
#if !defined(__minix)
|
||||
(void) close(ffd);
|
||||
#else
|
||||
vndio.vnd_fildes = ffd;
|
||||
#endif
|
||||
#endif /* defined(__minix) */
|
||||
|
||||
rv = ioctl(fd, VNDIOCSET, &vndio);
|
||||
#ifdef VNDIOOCSET
|
||||
@@ -513,9 +513,9 @@ config(char *dev, char *file, char *geom, int action)
|
||||
vndio.vnd_size = vndio.vnd_osize;
|
||||
}
|
||||
#endif
|
||||
#ifdef __minix
|
||||
#if defined(__minix)
|
||||
(void) close(ffd);
|
||||
#endif
|
||||
#endif /* defined(__minix) */
|
||||
if (rv)
|
||||
warn("%s: VNDIOCSET", rdev);
|
||||
else if (verbose) {
|
||||
@@ -530,17 +530,17 @@ config(char *dev, char *file, char *geom, int action)
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
#ifdef __minix
|
||||
#if defined(__minix)
|
||||
if ((ffd < 0 || rv) && service)
|
||||
stop++;
|
||||
#endif
|
||||
#endif /* defined(__minix) */
|
||||
}
|
||||
|
||||
#ifdef __minix
|
||||
#if defined(__minix)
|
||||
if (stop >= 2)
|
||||
stop_service(fd, rdev);
|
||||
else
|
||||
#endif
|
||||
#endif /* defined(__minix) */
|
||||
(void) close(fd);
|
||||
fflush(stdout);
|
||||
return (rv < 0);
|
||||
@@ -593,14 +593,14 @@ usage(void)
|
||||
{
|
||||
|
||||
(void)fprintf(stderr, "%s%s",
|
||||
#ifndef __minix
|
||||
#if !defined(__minix)
|
||||
"usage: vnconfig [-crvz] [-f disktab] [-t typename] vnode_disk"
|
||||
" regular-file [geomspec]\n",
|
||||
" vnconfig -u [-Fv] vnode_disk\n"
|
||||
#else
|
||||
"usage: vnconfig [-Scrv] vnode_disk regular-file [geomspec]\n",
|
||||
" vnconfig -u [-SFv] vnode_disk\n"
|
||||
#endif
|
||||
#endif /* !defined(__minix) */
|
||||
" vnconfig -l [vnode_disk]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
# $NetBSD: Makefile,v 1.9 2009/04/22 15:23:10 lukem Exp $
|
||||
|
||||
WARNS?= 2 # XXX -Wcast-qual in lib/libc/time
|
||||
# $NetBSD: Makefile,v 1.14 2013/03/06 18:21:41 christos Exp $
|
||||
|
||||
.include "Makefile.inc"
|
||||
.include <bsd.own.mk>
|
||||
|
||||
COPTS.zic.c += -Wno-format-nonliteral
|
||||
COPTS.scheck.c += -Wno-format-nonliteral
|
||||
|
||||
PROG= zic
|
||||
SRCS= zic.c scheck.c ialloc.c
|
||||
MAN= zic.8
|
||||
|
||||
2
usr.sbin/zic/Makefile.inc
Normal file
2
usr.sbin/zic/Makefile.inc
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
CPPFLAGS+=-DREPORT_BUGS_TO=\"gnats@netbsd.org\"
|
||||
Reference in New Issue
Block a user