summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/hp300/stand/libkern/Makefile6
-rw-r--r--sys/arch/hp300/stand/libsa/Makefile4
-rw-r--r--sys/arch/hp300/stand/libsaz/Makefile4
-rw-r--r--sys/arch/hppa/stand/libsa/dev_hppa.c5
-rw-r--r--sys/arch/i386/stand/libsa/Makefile6
-rw-r--r--sys/arch/i386/stand/libsa/dev_i386.c5
-rw-r--r--sys/arch/macppc/stand/boot.c12
-rw-r--r--sys/arch/macppc/stand/hfs.c8
-rw-r--r--sys/arch/mvme68k/stand/installboot/installboot.c4
-rw-r--r--sys/arch/mvme68k/stand/wrtvid/wrtvid.c8
-rw-r--r--sys/arch/mvme88k/stand/installboot/installboot.c6
-rw-r--r--sys/arch/mvme88k/stand/wrtvid/wrtvid.c8
-rw-r--r--sys/arch/mvmeppc/stand/installboot/installboot.c6
-rw-r--r--sys/arch/mvmeppc/stand/libsa/Makefile4
-rw-r--r--sys/arch/mvmeppc/stand/libsa/bugdev.c13
-rw-r--r--sys/arch/mvmeppc/stand/libsa/tftpfs.c6
-rw-r--r--sys/arch/sparc/stand/common/promdev.c4
-rw-r--r--sys/arch/sparc/stand/libkern/Makefile6
-rw-r--r--sys/arch/sparc/stand/libsa/Makefile4
-rw-r--r--sys/arch/sparc64/stand/libkern/Makefile6
-rw-r--r--sys/arch/sparc64/stand/libsa/Makefile4
-rw-r--r--sys/arch/sparc64/stand/ofwboot/boot.c35
-rw-r--r--sys/lib/libkern/arch/alpha/Makefile.inc4
-rw-r--r--sys/lib/libkern/arch/hppa/Makefile.inc6
-rw-r--r--sys/lib/libkern/arch/i386/Makefile.inc4
-rw-r--r--sys/lib/libkern/arch/m68k/Makefile.inc4
-rw-r--r--sys/lib/libkern/arch/m88k/Makefile.inc4
-rw-r--r--sys/lib/libkern/arch/mips/Makefile.inc4
-rw-r--r--sys/lib/libkern/arch/powerpc/Makefile.inc4
-rw-r--r--sys/lib/libkern/arch/sparc/Makefile.inc4
-rw-r--r--sys/lib/libkern/arch/sparc64/Makefile.inc4
-rw-r--r--sys/lib/libkern/arch/vax/Makefile.inc4
-rw-r--r--sys/lib/libkern/funcs.h2
-rw-r--r--sys/lib/libsa/Makefile7
-rw-r--r--sys/lib/libsa/Makefile.inc4
-rw-r--r--sys/lib/libsa/alloc.c14
-rw-r--r--sys/lib/libsa/arp.c18
-rw-r--r--sys/lib/libsa/bootp.c8
-rw-r--r--sys/lib/libsa/cd9660.c34
-rw-r--r--sys/lib/libsa/close.c14
-rw-r--r--sys/lib/libsa/closeall.c14
-rw-r--r--sys/lib/libsa/ctime.c4
-rw-r--r--sys/lib/libsa/ether.c6
-rw-r--r--sys/lib/libsa/exec.c6
-rw-r--r--sys/lib/libsa/exit.c38
-rw-r--r--sys/lib/libsa/ioctl.c14
-rw-r--r--sys/lib/libsa/iodesc.h4
-rw-r--r--sys/lib/libsa/loadfile.c6
-rw-r--r--sys/lib/libsa/lseek.c14
-rw-r--r--sys/lib/libsa/net.c4
-rw-r--r--sys/lib/libsa/net.h4
-rw-r--r--sys/lib/libsa/netif.c14
-rw-r--r--sys/lib/libsa/netif.h4
-rw-r--r--sys/lib/libsa/nfs.c42
-rw-r--r--sys/lib/libsa/nullfs.c14
-rw-r--r--sys/lib/libsa/open.c14
-rw-r--r--sys/lib/libsa/printf.c34
-rw-r--r--sys/lib/libsa/rarp.c16
-rw-r--r--sys/lib/libsa/read.c14
-rw-r--r--sys/lib/libsa/readdir.c8
-rw-r--r--sys/lib/libsa/rpc.c14
-rw-r--r--sys/lib/libsa/snprintf.c83
-rw-r--r--sys/lib/libsa/stand.h6
-rw-r--r--sys/lib/libsa/strcmp.c6
-rw-r--r--sys/lib/libsa/strerror.c6
-rw-r--r--sys/lib/libsa/strncmp.c6
-rw-r--r--sys/lib/libsa/strncpy.c6
-rw-r--r--sys/lib/libsa/ufs.c44
-rw-r--r--sys/lib/libsa/unixdev.c18
-rw-r--r--sys/lib/libsa/unixdev.h6
-rw-r--r--sys/lib/libsa/write.c16
-rw-r--r--sys/stand/boot/boot.c15
-rw-r--r--sys/stand/boot/bootarg.c6
-rw-r--r--sys/stand/boot/bootarg.h4
-rw-r--r--sys/stand/boot/cmd.c31
-rw-r--r--sys/stand/boot/cmd.h6
-rw-r--r--sys/stand/boot/vars.c23
77 files changed, 476 insertions, 401 deletions
diff --git a/sys/arch/hp300/stand/libkern/Makefile b/sys/arch/hp300/stand/libkern/Makefile
index d7f70c51ee2..587a9c18882 100644
--- a/sys/arch/hp300/stand/libkern/Makefile
+++ b/sys/arch/hp300/stand/libkern/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.4 1997/07/15 07:52:21 downsj Exp $
+# $OpenBSD: Makefile,v 1.5 2003/06/01 17:00:34 deraadt Exp $
LIB= kern
@@ -12,8 +12,8 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -I${.CURDIR}/../include \
-I${.CURDIR}/../../../.. -I${.CURDIR}/../../../../lib/libkern
# kern routines
-SRCS= __main.c ashrdi3.c divdi3.c qdivrem.c strlen.S strcat.S strcmp.S \
- strcpy.S strncmp.S umoddi3.c
+SRCS= __main.c ashrdi3.c divdi3.c qdivrem.c strlen.S strcmp.S \
+ strncmp.S umoddi3.c
${OBJS}: ${.CURDIR}/../Makefile.inc
diff --git a/sys/arch/hp300/stand/libsa/Makefile b/sys/arch/hp300/stand/libsa/Makefile
index 0cbacace464..0b823aa4e2a 100644
--- a/sys/arch/hp300/stand/libsa/Makefile
+++ b/sys/arch/hp300/stand/libsa/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.12 1999/08/16 09:43:09 downsj Exp $
+# $OpenBSD: Makefile,v 1.13 2003/06/01 17:00:34 deraadt Exp $
LIB= sa
@@ -11,7 +11,7 @@ CFLAGS= -O2 -msoft-float \
# stand routines
SRCS= alloc.c devopen.c exit.c exec.c getfile.c gets.c globals.c \
- memcmp.c memcpy.c memset.c printf.c strerror.c strncpy.c
+ memcmp.c memcpy.c memset.c printf.c snprintf.c strerror.c strncpy.c
# io routines
SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \
diff --git a/sys/arch/hp300/stand/libsaz/Makefile b/sys/arch/hp300/stand/libsaz/Makefile
index 116f29a52c2..e7d14dd138f 100644
--- a/sys/arch/hp300/stand/libsaz/Makefile
+++ b/sys/arch/hp300/stand/libsaz/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.1 1999/08/16 09:43:10 downsj Exp $
+# $OpenBSD: Makefile,v 1.2 2003/06/01 17:00:34 deraadt Exp $
LIB= saz
@@ -11,7 +11,7 @@ CFLAGS= -O2 -msoft-float -D__INTERNAL_LIBSA_CREAD \
# stand routines
SRCS= alloc.c devopen.c exit.c exec.c getfile.c gets.c globals.c \
- memcmp.c memcpy.c memset.c printf.c strerror.c strncpy.c
+ memcmp.c memcpy.c memset.c printf.c snprintf.c strerror.c strncpy.c
# io routines
SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \
diff --git a/sys/arch/hppa/stand/libsa/dev_hppa.c b/sys/arch/hppa/stand/libsa/dev_hppa.c
index 6d720ef753a..932b7fe227f 100644
--- a/sys/arch/hppa/stand/libsa/dev_hppa.c
+++ b/sys/arch/hppa/stand/libsa/dev_hppa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dev_hppa.c,v 1.8 2003/04/16 07:20:50 mickey Exp $ */
+/* $OpenBSD: dev_hppa.c,v 1.9 2003/06/01 17:00:34 deraadt Exp $ */
/*
* Copyright (c) 1998 Michael Shalayeff
@@ -219,7 +219,8 @@ char *
ttyname(fd)
int fd;
{
- sprintf(ttyname_buf, "%s%d", cdevs[major(cn_tab->cn_dev)],
+ snprintf(ttyname_buf, sizeof ttyname_buf, "%s%d",
+ cdevs[major(cn_tab->cn_dev)],
minor(cn_tab->cn_dev));
return (ttyname_buf);
}
diff --git a/sys/arch/i386/stand/libsa/Makefile b/sys/arch/i386/stand/libsa/Makefile
index a40af3711b4..22d48c315ed 100644
--- a/sys/arch/i386/stand/libsa/Makefile
+++ b/sys/arch/i386/stand/libsa/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.40 2003/04/17 03:43:18 drahn Exp $
+# $OpenBSD: Makefile,v 1.41 2003/06/01 17:00:35 deraadt Exp $
.include "${.CURDIR}/../Makefile.inc"
@@ -28,8 +28,8 @@ CLEANFILES+= unixdev.o unixsys.o nullfs.o
# stand routines
SRCS+= alloc.c exit.c getfile.c gets.c globals.c strcmp.c strlen.c \
- strncmp.c memcmp.c memcpy.c memset.c printf.c strerror.c strncpy.c \
- strtol.c ctime.c
+ strncmp.c memcmp.c memcpy.c memset.c printf.c snprintf.c \
+ strerror.c strncpy.c strtol.c ctime.c strlcpy.c strlcat.c
# io routines
SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \
diff --git a/sys/arch/i386/stand/libsa/dev_i386.c b/sys/arch/i386/stand/libsa/dev_i386.c
index 86817886fcc..8389c3a26e8 100644
--- a/sys/arch/i386/stand/libsa/dev_i386.c
+++ b/sys/arch/i386/stand/libsa/dev_i386.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dev_i386.c,v 1.24 2001/09/11 06:06:15 fgsch Exp $ */
+/* $OpenBSD: dev_i386.c,v 1.25 2003/06/01 17:00:35 deraadt Exp $ */
/*
* Copyright (c) 1996-1999 Michael Shalayeff
@@ -167,7 +167,8 @@ char *
ttyname(fd)
int fd;
{
- sprintf(ttyname_buf, "%s%d", cdevs[major(cn_tab->cn_dev)],
+ snprintf(ttyname_buf, sizeof ttyname_buf, "%s%d",
+ cdevs[major(cn_tab->cn_dev)],
minor(cn_tab->cn_dev));
return (ttyname_buf);
}
diff --git a/sys/arch/macppc/stand/boot.c b/sys/arch/macppc/stand/boot.c
index 14b94c818b3..c1af395f2cc 100644
--- a/sys/arch/macppc/stand/boot.c
+++ b/sys/arch/macppc/stand/boot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: boot.c,v 1.8 2002/09/15 09:01:59 deraadt Exp $ */
+/* $OpenBSD: boot.c,v 1.9 2003/06/01 17:00:36 deraadt Exp $ */
/* $NetBSD: boot.c,v 1.1 1997/04/16 20:29:17 thorpej Exp $ */
/*
@@ -181,9 +181,9 @@ main()
/*
* Get the boot arguments from Openfirmware
*/
- if ((chosen = OF_finddevice("/chosen")) == -1
- || OF_getprop(chosen, "bootpath", bootdev, sizeof bootdev) < 0
- || OF_getprop(chosen, "bootargs", bootline, sizeof bootline) < 0) {
+ if ((chosen = OF_finddevice("/chosen")) == -1 ||
+ OF_getprop(chosen, "bootpath", bootdev, sizeof bootdev) < 0 ||
+ OF_getprop(chosen, "bootargs", bootline, sizeof bootline) < 0) {
printf("Invalid Openfirmware environment\n");
exit();
}
@@ -206,7 +206,7 @@ main()
OF_setprop(chosen, "bootpath", opened_name, strlen(opened_name) + 1);
cp = bootline;
#else
- strcpy(bootline, opened_name);
+ strlcpy(bootline, opened_name, sizeof bootline);
cp = bootline + strlen(bootline);
*cp++ = ' ';
#endif
@@ -234,7 +234,7 @@ main()
ssym = (void *)marks[MARK_SYM];
esym = (void *)marks[MARK_END];
- chain ((void *)entry, bootline, ssym, esym);
+ chain((void *)entry, bootline, ssym, esym);
_rtt();
return 0;
diff --git a/sys/arch/macppc/stand/hfs.c b/sys/arch/macppc/stand/hfs.c
index de677b7fe74..da3116e3297 100644
--- a/sys/arch/macppc/stand/hfs.c
+++ b/sys/arch/macppc/stand/hfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hfs.c,v 1.1 2001/09/01 15:39:02 drahn Exp $ */
+/* $OpenBSD: hfs.c,v 1.2 2003/06/01 17:00:36 deraadt Exp $ */
/* $NetBSD: hfs.c,v 1.1 2000/11/14 11:25:35 tsubai Exp $ */
/*-
@@ -44,7 +44,6 @@ hfs_open(path, f)
int chosen;
char bootpath[128], *cp;
-
if ((chosen = OF_finddevice("/chosen")) == -1)
return ENXIO;
bzero(bootpath, sizeof bootpath);
@@ -54,7 +53,7 @@ hfs_open(path, f)
cp = strrchr(bootpath, ',');
#else
cp = bootpath;
- cp += strlen (bootpath);
+ cp += strlen(bootpath);
for (; *cp != ','; cp--) {
if (cp == bootpath) {
cp = NULL;
@@ -65,11 +64,10 @@ hfs_open(path, f)
if (cp == NULL)
return ENXIO;
- strcpy(cp + 1, path);
+ strlcpy(cp + 1, path, bootpath + sizeof bootpath - (cp + 1));
OF_fd = OF_open(bootpath);
if (OF_fd == -1)
return ENOENT;
-
return 0;
}
diff --git a/sys/arch/mvme68k/stand/installboot/installboot.c b/sys/arch/mvme68k/stand/installboot/installboot.c
index 9d75b14e384..c8403cdf62e 100644
--- a/sys/arch/mvme68k/stand/installboot/installboot.c
+++ b/sys/arch/mvme68k/stand/installboot/installboot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: installboot.c,v 1.7 2002/03/14 03:15:56 millert Exp $ */
+/* $OpenBSD: installboot.c,v 1.8 2003/06/01 17:00:36 deraadt Exp $ */
/* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */
/*
@@ -121,7 +121,7 @@ main(argc, argv)
boot = argv[optind];
proto = argv[optind + 1];
dev = argv[optind + 2];
- strcpy(cdev, dev);
+ strlcpy(cdev, dev, sizeof cdev);
cdev[strlen(cdev)-1] = 'c';
if (verbose) {
diff --git a/sys/arch/mvme68k/stand/wrtvid/wrtvid.c b/sys/arch/mvme68k/stand/wrtvid/wrtvid.c
index fe4f65d9efd..e9b4b98f230 100644
--- a/sys/arch/mvme68k/stand/wrtvid/wrtvid.c
+++ b/sys/arch/mvme68k/stand/wrtvid/wrtvid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wrtvid.c,v 1.3 1996/04/28 10:49:49 deraadt Exp $ */
+/* $OpenBSD: wrtvid.c,v 1.4 2003/06/01 17:00:37 deraadt Exp $ */
#include <sys/types.h>
#include <sys/stat.h>
@@ -35,15 +35,15 @@ main(argc, argv)
perror(filename);
exit(2);
}
- sprintf(fileext, "%c%cboot", filename[4], filename[5]);
+ snprintf(fileext, sizeof fileext, "%c%cboot", filename[4], filename[5]);
tape_vid = open(fileext, O_WRONLY|O_CREAT|O_TRUNC, 0644);
- sprintf(fileext, "boot%c%c", filename[4], filename[5]);
+ snprintf(fileext, sizeof fileext, "boot%c%c", filename[4], filename[5]);
tape_exe = open(fileext, O_WRONLY|O_CREAT|O_TRUNC,0644);
pcpul = (struct cpu_disklabel *)malloc(sizeof(struct cpu_disklabel));
bzero(pcpul, sizeof(struct cpu_disklabel));
- strcpy(pcpul->vid_id, "NBSD");
+ memcpy(pcpul->vid_id, "NBSD", sizeof pcpul->vid_id);
fstat(exe_file, &stat);
/* size in 256 byte blocks round up after a.out header removed */
diff --git a/sys/arch/mvme88k/stand/installboot/installboot.c b/sys/arch/mvme88k/stand/installboot/installboot.c
index 19fc29f7f66..760a5d32ee8 100644
--- a/sys/arch/mvme88k/stand/installboot/installboot.c
+++ b/sys/arch/mvme88k/stand/installboot/installboot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: installboot.c,v 1.6 2002/03/14 03:15:57 millert Exp $ */
+/* $OpenBSD: installboot.c,v 1.7 2003/06/01 17:00:37 deraadt Exp $ */
/* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */
/*
@@ -121,7 +121,7 @@ main(argc, argv)
boot = argv[optind];
proto = argv[optind + 1];
dev = argv[optind + 2];
- strcpy(cdev, dev);
+ strlcpy(cdev, dev, sizeof cdev);
cdev[strlen(cdev)-1] = 'c';
if (verbose) {
@@ -423,7 +423,7 @@ char *bootproto;
pcpul->version = 1;
- strcpy(pcpul->vid_id, "M88K");
+ memcpy(pcpul->vid_id, "M88K", sizeof pcpul->vid_id);
fstat(exe_file, &stat);
diff --git a/sys/arch/mvme88k/stand/wrtvid/wrtvid.c b/sys/arch/mvme88k/stand/wrtvid/wrtvid.c
index 420ff803c6f..cc27853dcc2 100644
--- a/sys/arch/mvme88k/stand/wrtvid/wrtvid.c
+++ b/sys/arch/mvme88k/stand/wrtvid/wrtvid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wrtvid.c,v 1.3 1998/08/22 08:52:56 smurph Exp $ */
+/* $OpenBSD: wrtvid.c,v 1.4 2003/06/01 17:00:37 deraadt Exp $ */
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -38,16 +38,16 @@ main(argc, argv)
perror(filename);
exit(2);
}
- sprintf(fileext, "%c%cboot", filename[4], filename[5]);
+ snprintf(fileext, sizeof fileext, "%c%cboot", filename[4], filename[5]);
tape_vid = open(fileext, O_WRONLY|O_CREAT|O_TRUNC, 0644);
- sprintf(fileext, "boot%c%c", filename[4], filename[5]);
+ snprintf(fileext, sizeof fileext, "boot%c%c", filename[4], filename[5]);
tape_exe = open(fileext, O_WRONLY|O_CREAT|O_TRUNC,0644);
pcpul = (struct cpu_disklabel *)malloc(sizeof(struct cpu_disklabel));
bzero(pcpul, sizeof(struct cpu_disklabel));
pcpul->version = 1;
- strcpy(pcpul->vid_id, "M88K");
+ memcpy(pcpul->vid_id, "M88K", sizeof pcpul->vid_id);
fstat(exe_file, &stat);
/* size in 256 byte blocks round up after a.out header removed */
diff --git a/sys/arch/mvmeppc/stand/installboot/installboot.c b/sys/arch/mvmeppc/stand/installboot/installboot.c
index 813ca3042dc..9f0fc87c189 100644
--- a/sys/arch/mvmeppc/stand/installboot/installboot.c
+++ b/sys/arch/mvmeppc/stand/installboot/installboot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: installboot.c,v 1.4 2002/03/14 03:15:58 millert Exp $ */
+/* $OpenBSD: installboot.c,v 1.5 2003/06/01 17:00:38 deraadt Exp $ */
/* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */
/*
@@ -121,7 +121,7 @@ main(argc, argv)
boot = argv[optind];
proto = argv[optind + 1];
dev = argv[optind + 2];
- strcpy(cdev, dev);
+ strlcpy(cdev, dev, sizeof cdev);
cdev[strlen(cdev)-1] = 'c';
if (verbose) {
@@ -423,7 +423,7 @@ char *bootproto;
pcpul->version = 1;
- strcpy(pcpul->vid_id, "M88K");
+ memcpy(pcpul->vid_id, "M88K", sizeof pcpul->vid_id);
fstat(exe_file, &stat);
diff --git a/sys/arch/mvmeppc/stand/libsa/Makefile b/sys/arch/mvmeppc/stand/libsa/Makefile
index 3c8b70fa1ea..4e8cad5fd99 100644
--- a/sys/arch/mvmeppc/stand/libsa/Makefile
+++ b/sys/arch/mvmeppc/stand/libsa/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.1 2001/06/26 21:58:06 smurph Exp $
+# $OpenBSD: Makefile,v 1.2 2003/06/01 17:00:38 deraadt Exp $
LIB=sa
@@ -21,7 +21,7 @@ SRC_sa= alloc.c memcpy.c exit.c getfile.c gets.c globals.c \
lseek.c open.c nullfs.c read.c fstat.c \
ufs.c cread.c
-SRC_kern= ashrdi3.c bzero.c strcpy.c
+SRC_kern= ashrdi3.c bzero.c
SRC_mvme= exec_mvme.c
diff --git a/sys/arch/mvmeppc/stand/libsa/bugdev.c b/sys/arch/mvmeppc/stand/libsa/bugdev.c
index b3a8c8bce27..7943924c56b 100644
--- a/sys/arch/mvmeppc/stand/libsa/bugdev.c
+++ b/sys/arch/mvmeppc/stand/libsa/bugdev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bugdev.c,v 1.1 2001/06/26 21:58:07 smurph Exp $ */
+/* $OpenBSD: bugdev.c,v 1.2 2003/06/01 17:00:38 deraadt Exp $ */
/*
* Copyright (c) 1993 Paul Kranenburg
@@ -425,7 +425,8 @@ retry:
printf(" IO @ %x\n", io);
printf("MEM @ %x\n", mem);
-#define PRINT_REG(regname, x) printf("%s = 0x%x\n", regname, md_swap_long(*(unsigned *)(io + x)))
+#define PRINT_REG(regname, x) printf("%s = 0x%x\n", regname, \
+ md_swap_long(*(unsigned *)(io + x)))
PRINT_REG("CSR0", 0x00);
PRINT_REG("CSR1", 0x08);
@@ -472,19 +473,21 @@ net_open(struct open_file *f, ...)
va_end(ap);
#ifdef DEBUG
- printf("net_open: using mvmebug ctrl %d dev %d, filename: %s\n", pp->clun, pp->dlun, filename);
+ printf("net_open: using mvmebug ctrl %d dev %d, filename: %s\n",
+ pp->clun, pp->dlun, filename);
#endif
nfo.clun = pp->clun;
nfo.dlun = pp->dlun;
nfo.status = 0;
- strcpy(nfo.filename, filename);
+ strlcpy(nfo.filename, filename, sizeof filename);
/* .NETFOPN syscall */
mvmeprom_netfopen(&nfo);
#ifdef DEBUG
if (nfo.status) {
nfoerr = nfo.status;
- printf("net_open: ci err = 0x%x, cd err = 0x%x\n", ((nfoerr >> 8) & 0x0F), (nfoerr & 0x0F));
+ printf("net_open: ci err = 0x%x, cd err = 0x%x\n",
+ ((nfoerr >> 8) & 0x0F), (nfoerr & 0x0F));
}
#endif
return (nfo.status);
diff --git a/sys/arch/mvmeppc/stand/libsa/tftpfs.c b/sys/arch/mvmeppc/stand/libsa/tftpfs.c
index 9e6a3c9e8e2..42f897506df 100644
--- a/sys/arch/mvmeppc/stand/libsa/tftpfs.c
+++ b/sys/arch/mvmeppc/stand/libsa/tftpfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tftpfs.c,v 1.2 2002/03/14 01:26:41 millert Exp $ */
+/* $OpenBSD: tftpfs.c,v 1.3 2003/06/01 17:00:38 deraadt Exp $ */
/*-
* Copyright (c) 2001 Steve Murphree, Jr.
@@ -119,7 +119,7 @@ tftp_read_file(f, buf_p, size_p)
* and start again.
*/
char filename[64];
- strcpy(filename, fp->filename);
+ strlcpy(filename, fp->filename, sizeof filename);
tftpfs_close(f);
tftpfs_open(filename, f);
for (i = 1; i <= file_block; i++) {
@@ -171,7 +171,7 @@ tftpfs_open(path, f)
bzero(fp->f_buf, TFTP_BLOCK_SIZE);
fp->f_buf_size = 0;
- strcpy(fp->filename, path);
+ strlcpy(fp->filename, path, sizeof fp->filename);
if (f->f_dev->dv_open == NULL) {
panic("No device open()!");
diff --git a/sys/arch/sparc/stand/common/promdev.c b/sys/arch/sparc/stand/common/promdev.c
index 54ae9041910..719c162e818 100644
--- a/sys/arch/sparc/stand/common/promdev.c
+++ b/sys/arch/sparc/stand/common/promdev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: promdev.c,v 1.7 2002/08/15 15:41:35 millert Exp $ */
+/* $OpenBSD: promdev.c,v 1.8 2003/06/01 17:00:39 deraadt Exp $ */
/* $NetBSD: promdev.c,v 1.16 1995/11/14 15:04:01 pk Exp $ */
/*
@@ -534,7 +534,7 @@ prom_getether(fd, ea)
(void)(*promvec->pv_enaddr)(fd, (char *)ea);
} else {
char buf[64];
- sprintf(buf, "%x mac-address drop swap 6 cmove", ea);
+ snprintf(buf, sizeof buf, "%x mac-address drop swap 6 cmove", ea);
promvec->pv_fortheval.v2_eval(buf);
}
}
diff --git a/sys/arch/sparc/stand/libkern/Makefile b/sys/arch/sparc/stand/libkern/Makefile
index 594e0c0da47..d739830daef 100644
--- a/sys/arch/sparc/stand/libkern/Makefile
+++ b/sys/arch/sparc/stand/libkern/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.2 1999/12/10 10:40:47 deraadt Exp $
+# $OpenBSD: Makefile,v 1.3 2003/06/01 17:00:39 deraadt Exp $
LIB= kern
@@ -16,8 +16,8 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -I${.CURDIR}/../include \
-I${.CURDIR}/../../../../lib/libkern/arch/sparc
# kern routines
-SRCS= __main.c ashrdi3.c bzero.S divdi3.c qdivrem.c strlen.S strcat.c \
- strcmp.c strcpy.c strncmp.c umoddi3.c
+SRCS= __main.c ashrdi3.c bzero.S divdi3.c qdivrem.c strlen.S \
+ strcmp.c strncmp.c umoddi3.c
SRCS+= umul.S mul.S rem.S sdiv.S udiv.S urem.S
SRCS+= saveregs.S
diff --git a/sys/arch/sparc/stand/libsa/Makefile b/sys/arch/sparc/stand/libsa/Makefile
index 68e3495cf31..0002c987e1a 100644
--- a/sys/arch/sparc/stand/libsa/Makefile
+++ b/sys/arch/sparc/stand/libsa/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.1 1997/09/17 10:46:23 downsj Exp $
+# $OpenBSD: Makefile,v 1.2 2003/06/01 17:00:39 deraadt Exp $
LIB= sa
@@ -11,7 +11,7 @@ CFLAGS= -O2 -D__INTERNAL_LIBSA_CREAD \
# stand routines
SRCS= alloc.c exit.c exec.c getfile.c gets.c globals.c \
- memcmp.c memcpy.c memset.c printf.c strerror.c strncpy.c
+ memcmp.c memcpy.c memset.c printf.c snprintf.c strerror.c strncpy.c
# io routines
SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \
diff --git a/sys/arch/sparc64/stand/libkern/Makefile b/sys/arch/sparc64/stand/libkern/Makefile
index d49b2a7bc58..3eb6bb9a2c8 100644
--- a/sys/arch/sparc64/stand/libkern/Makefile
+++ b/sys/arch/sparc64/stand/libkern/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.4 2003/04/09 10:35:04 sturm Exp $
+# $OpenBSD: Makefile,v 1.5 2003/06/01 17:00:39 deraadt Exp $
LIB= kern
@@ -16,8 +16,8 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -I${.CURDIR}/../include \
-I${.CURDIR}/../../../../lib/libkern/arch/sparc
# kern routines
-SRCS= __main.c ashrdi3.c bzero.S divdi3.c qdivrem.c strlen.S strcat.c \
- strcmp.c strcpy.c strlcat.c strlcpy.c strncmp.c umoddi3.c
+SRCS= __main.c ashrdi3.c bzero.S divdi3.c qdivrem.c strlen.S \
+ strcmp.c strlcat.c strlcpy.c strncmp.c umoddi3.c
SRCS+= umul.S mul.S rem.S sdiv.S udiv.S urem.S
SRCS+= saveregs.S
diff --git a/sys/arch/sparc64/stand/libsa/Makefile b/sys/arch/sparc64/stand/libsa/Makefile
index 4c92556a661..fd55dd6063f 100644
--- a/sys/arch/sparc64/stand/libsa/Makefile
+++ b/sys/arch/sparc64/stand/libsa/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.4 2001/10/10 20:41:40 miod Exp $
+# $OpenBSD: Makefile,v 1.5 2003/06/01 17:00:40 deraadt Exp $
LIB= sa
@@ -16,7 +16,7 @@ CPPFLAGS+= -D__INTERNAL_LIBSA_CREAD
# stand routines
SRCS= alloc.c exit.c exec.c getfile.c gets.c globals.c \
- memcmp.c memcpy.c memset.c printf.c strerror.c strncpy.c
+ memcmp.c memcpy.c memset.c printf.c snprintf.c strerror.c strncpy.c
# io routines
SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \
diff --git a/sys/arch/sparc64/stand/ofwboot/boot.c b/sys/arch/sparc64/stand/ofwboot/boot.c
index 9a2b3378256..0ab68c0218f 100644
--- a/sys/arch/sparc64/stand/ofwboot/boot.c
+++ b/sys/arch/sparc64/stand/ofwboot/boot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: boot.c,v 1.7 2003/05/11 20:22:20 mdw Exp $ */
+/* $OpenBSD: boot.c,v 1.8 2003/06/01 17:00:40 deraadt Exp $ */
/* $NetBSD: boot.c,v 1.3 2001/05/31 08:55:19 mrg Exp $ */
/*
* Copyright (c) 1997, 1999 Eduardo E. Horvath. All rights reserved.
@@ -209,7 +209,7 @@ chain(pentry, args, ssym, esym)
#ifdef DEBUG
printf("chain: calling OF_chain(%x, %x, %x, %x, %x)\n",
- (void *)RELOC, end - (char *)RELOC, entry, args, l);
+ (void *)RELOC, end - (char *)RELOC, entry, args, l);
#endif
/* if -D is set then pause in the PROM. */
if (debug > 1) OF_enter();
@@ -248,7 +248,7 @@ loadfile(fd, args)
printf("read header: %s\n", strerror(errno));
else
printf("read header: short read (only %d of %d)\n",
- rval, sizeof(hdr));
+ rval, sizeof(hdr));
rval = 1;
goto err;
}
@@ -263,8 +263,7 @@ loadfile(fd, args)
if (bcmp(hdr.elf32.e_ident, ELFMAG, SELFMAG) == 0 &&
hdr.elf32.e_ident[EI_CLASS] == ELFCLASS32) {
rval = elf32_exec(fd, &hdr.elf32, &entry, &ssym, &esym);
- } else
- if (bcmp(hdr.elf64.e_ident, ELFMAG, SELFMAG) == 0 &&
+ } else if (bcmp(hdr.elf64.e_ident, ELFMAG, SELFMAG) == 0 &&
hdr.elf64.e_ident[EI_CLASS] == ELFCLASS64) {
rval = elf64_exec(fd, &hdr.elf64, &entry, &ssym, &esym);
} else
@@ -476,8 +475,8 @@ elf32_exec(fd, elf, entryp, ssymp, esymp)
for (i = 0; i < elf->e_shnum; i++, shp++) {
if (shp->sh_type == SHT_NULL)
continue;
- if (shp->sh_type != SHT_SYMTAB
- && shp->sh_type != SHT_STRTAB) {
+ if (shp->sh_type != SHT_SYMTAB &&
+ shp->sh_type != SHT_STRTAB) {
shp->sh_offset = 0;
shp->sh_type = SHT_NOBITS;
continue;
@@ -511,8 +510,8 @@ elf32_exec(fd, elf, entryp, ssymp, esymp)
addr += sizeof(Elf32_Ehdr) + (elf->e_shnum * sizeof(Elf32_Shdr));
off = sizeof(Elf32_Ehdr) + (elf->e_shnum * sizeof(Elf32_Shdr));
for (first = 1, i = 0; i < elf->e_shnum; i++, shp++) {
- if (shp->sh_type == SHT_SYMTAB
- || shp->sh_type == SHT_STRTAB) {
+ if (shp->sh_type == SHT_SYMTAB ||
+ shp->sh_type == SHT_STRTAB) {
if (first)
printf("symbols @ 0x%lx ", (u_long)addr);
printf("%s%d", first ? "" : "+", shp->sh_size);
@@ -552,9 +551,9 @@ main()
/*
* Get the boot arguments from Openfirmware
*/
- if ((chosen = OF_finddevice("/chosen")) == -1
- || OF_getprop(chosen, "bootpath", bootdev, sizeof bootdev) < 0
- || OF_getprop(chosen, "bootargs", bootline, sizeof bootline) < 0) {
+ if ((chosen = OF_finddevice("/chosen")) == -1 ||
+ OF_getprop(chosen, "bootpath", bootdev, sizeof bootdev) < 0 ||
+ OF_getprop(chosen, "bootargs", bootline, sizeof bootline) < 0) {
printf("Invalid Openfirmware environment\n");
exit();
}
@@ -569,8 +568,8 @@ main()
*/
bootlp = kernels;
- if (parseargs(bootline, &boothowto) == -1
- || (boothowto & RB_ASKNAME)) {
+ if (parseargs(bootline, &boothowto) == -1 ||
+ (boothowto & RB_ASKNAME)) {
bootlp = 0;
} else if (*bootline) {
just_bootline[0] = bootline;
@@ -586,7 +585,7 @@ main()
kernels[0] = 0; /* no more iteration */
} else if (cp != bootline) {
printf(": trying %s...\n", cp);
- strcpy(bootline, cp);
+ strlcpy(bootline, cp, sizeof bootline);
}
}
if (!bootlp) {
@@ -598,8 +597,8 @@ main()
bootlp = kernels;
continue;
}
- if (strcmp(bootline, "exit") == 0
- || strcmp(bootline, "halt") == 0) {
+ if (strcmp(bootline, "exit") == 0 ||
+ strcmp(bootline, "halt") == 0) {
_rtt();
}
}
@@ -611,7 +610,7 @@ main()
OF_setprop(chosen, "bootpath", opened_name, strlen(opened_name) + 1);
cp = bootline;
#else
- strcpy(bootline, opened_name);
+ strlcpy(bootline, opened_name, sizeof bootline);
cp = bootline + strlen(bootline);
*cp++ = ' ';
#endif
diff --git a/sys/lib/libkern/arch/alpha/Makefile.inc b/sys/lib/libkern/arch/alpha/Makefile.inc
index b984665e3a5..2cef95cd260 100644
--- a/sys/lib/libkern/arch/alpha/Makefile.inc
+++ b/sys/lib/libkern/arch/alpha/Makefile.inc
@@ -1,9 +1,9 @@
-# $OpenBSD: Makefile.inc,v 1.12 2002/04/28 20:55:14 pvalchev Exp $
+# $OpenBSD: Makefile.inc,v 1.13 2003/06/01 17:00:30 deraadt Exp $
# $NetBSD: Makefile.inc,v 1.9 1996/08/27 00:44:24 cgd Exp $
SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
memchr.c memcmp.c memset.c \
- bcmp.c bzero.S ffs.S softfloat.c strcat.c strcmp.c strcpy.c \
+ bcmp.c bzero.S ffs.S softfloat.c strcmp.c \
strlcat.c strlcpy.c strlen.c strncmp.c \
strncpy.c scanc.c skpc.c htonl.S htons.S ntohl.S ntohs.S \
random.c strncasecmp.c
diff --git a/sys/lib/libkern/arch/hppa/Makefile.inc b/sys/lib/libkern/arch/hppa/Makefile.inc
index abef9b9e0d0..47bd03f41f1 100644
--- a/sys/lib/libkern/arch/hppa/Makefile.inc
+++ b/sys/lib/libkern/arch/hppa/Makefile.inc
@@ -1,9 +1,9 @@
-# $OpenBSD: Makefile.inc,v 1.16 2003/01/28 22:55:53 mickey Exp $
+# $OpenBSD: Makefile.inc,v 1.17 2003/06/01 17:00:30 deraadt Exp $
SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
random.c ashrdi3.c divdi3.c strncpy.c strncmp.c strcmp.c memchr.c \
- memcmp.c memset.c strlen.c strcpy.c strlcpy.c strlcat.c \
- strcat.c skpc.c strncasecmp.c \
+ memcmp.c memset.c strlen.c strlcpy.c strlcat.c \
+ skpc.c strncasecmp.c \
bcmp.c scanc.c ffs.c
SRCS+= milli.S
diff --git a/sys/lib/libkern/arch/i386/Makefile.inc b/sys/lib/libkern/arch/i386/Makefile.inc
index 00928bb3c2c..eacb3cc5bbb 100644
--- a/sys/lib/libkern/arch/i386/Makefile.inc
+++ b/sys/lib/libkern/arch/i386/Makefile.inc
@@ -1,9 +1,9 @@
-# $OpenBSD: Makefile.inc,v 1.7 2000/12/18 18:40:46 provos Exp $
+# $OpenBSD: Makefile.inc,v 1.8 2003/06/01 17:00:30 deraadt Exp $
# $NetBSD: Makefile.inc,v 1.10 1996/04/13 01:17:41 cgd Exp $
SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
memchr.S memcmp.S \
- bcmp.S ffs.S memset.S strcat.S strcmp.S strcpy.S strlcat.c strlcpy.c \
+ bcmp.S ffs.S memset.S strcmp.S strlcat.c strlcpy.c \
strlen.S strncmp.c \
strncpy.c scanc.S skpc.S locc.S htonl.S htons.S ntohl.S ntohs.S \
strncasecmp.c
diff --git a/sys/lib/libkern/arch/m68k/Makefile.inc b/sys/lib/libkern/arch/m68k/Makefile.inc
index 41329201e3e..fd44dc81ac6 100644
--- a/sys/lib/libkern/arch/m68k/Makefile.inc
+++ b/sys/lib/libkern/arch/m68k/Makefile.inc
@@ -1,9 +1,9 @@
-# $OpenBSD: Makefile.inc,v 1.7 2000/12/18 18:40:46 provos Exp $
+# $OpenBSD: Makefile.inc,v 1.8 2003/06/01 17:00:30 deraadt Exp $
# $NetBSD: Makefile.inc,v 1.7 1996/04/18 01:53:04 cgd Exp $
SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
memchr.c memcmp.S memset.S \
- bcmp.S bzero.S ffs.S strcat.S strcmp.S strcpy.S strlcat.c strlcpy.c \
+ bcmp.S bzero.S ffs.S strcmp.S strlcat.c strlcpy.c \
strlen.S strncmp.S \
strncpy.S htonl.S htons.S ntohl.S ntohs.S scanc.S skpc.S locc.S \
strncasecmp.c
diff --git a/sys/lib/libkern/arch/m88k/Makefile.inc b/sys/lib/libkern/arch/m88k/Makefile.inc
index e5c2cb3055d..981b6ce386d 100644
--- a/sys/lib/libkern/arch/m88k/Makefile.inc
+++ b/sys/lib/libkern/arch/m88k/Makefile.inc
@@ -1,7 +1,7 @@
-# $OpenBSD: Makefile.inc,v 1.5 2001/02/01 03:25:42 smurph Exp $
+# $OpenBSD: Makefile.inc,v 1.6 2003/06/01 17:00:30 deraadt Exp $
# $NetBSD: Makefile.inc,v 1.2 1996/04/13 01:17:58 cgd Exp $
SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
memchr.c memcmp.c memset.c bcmp.c random.c \
- strcat.c strcmp.c strcpy.c strlcat.c strlcpy.c strlen.c strncmp.c \
+ strcmp.c strlcat.c strlcpy.c strlen.c strncmp.c \
strncpy.c scanc.c skpc.c strncasecmp.c ffs.c
diff --git a/sys/lib/libkern/arch/mips/Makefile.inc b/sys/lib/libkern/arch/mips/Makefile.inc
index d3b951e07b5..420fb818fd4 100644
--- a/sys/lib/libkern/arch/mips/Makefile.inc
+++ b/sys/lib/libkern/arch/mips/Makefile.inc
@@ -1,11 +1,11 @@
-# $OpenBSD: Makefile.inc,v 1.9 2000/12/18 18:40:46 provos Exp $
+# $OpenBSD: Makefile.inc,v 1.10 2003/06/01 17:00:31 deraadt Exp $
# $NetBSD: Makefile.inc,v 1.4 1996/04/13 01:17:46 cgd Exp $
#
# There are likely more that we will notice when we go native
SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
memchr.c memcmp.c memset.c strcmp.c \
- bcmp.S bcopy.S bzero.S strcat.c strcmp.c strcpy.c strlcat.c strlcpy.c \
+ bcmp.S bcopy.S bzero.S strcmp.c strlcat.c strlcpy.c \
ffs.S htonl.S \
htons.S strcmp.S strlen.S strncmp.c random.c scanc.c skpc.c strncpy.c \
strncasecmp.c
diff --git a/sys/lib/libkern/arch/powerpc/Makefile.inc b/sys/lib/libkern/arch/powerpc/Makefile.inc
index d4044794977..4063f90ed0b 100644
--- a/sys/lib/libkern/arch/powerpc/Makefile.inc
+++ b/sys/lib/libkern/arch/powerpc/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.9 2002/11/11 16:32:48 drahn Exp $
+# $OpenBSD: Makefile.inc,v 1.10 2003/06/01 17:00:31 deraadt Exp $
# $NetBSD: Makefile.inc,v 1.6 1994/10/26 06:39:03 cgd Exp $
CFLAGS += -D_KERNEL
@@ -6,7 +6,7 @@ CFLAGS += -D_KERNEL
SRCS+= __main.c __eabi.c \
imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
memchr.c memcmp.c memset.c \
- bcmp.c ffs.c strcat.c strcmp.c strcpy.c strlcat.c strlcpy.c \
+ bcmp.c ffs.c strcmp.c strlcat.c strlcpy.c \
strlen.c strncmp.c \
strncpy.c scanc.c skpc.c locc.c \
memcpy.c random.c strncasecmp.c
diff --git a/sys/lib/libkern/arch/sparc/Makefile.inc b/sys/lib/libkern/arch/sparc/Makefile.inc
index 2560b9391b9..b2c73360f51 100644
--- a/sys/lib/libkern/arch/sparc/Makefile.inc
+++ b/sys/lib/libkern/arch/sparc/Makefile.inc
@@ -1,9 +1,9 @@
-# $OpenBSD: Makefile.inc,v 1.10 2002/08/11 12:21:33 art Exp $
+# $OpenBSD: Makefile.inc,v 1.11 2003/06/01 17:00:31 deraadt Exp $
# $NetBSD: Makefile.inc,v 1.12 1996/04/23 23:05:22 christos Exp $
SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
memchr.c memcmp.c memset.c \
- bcmp.c bzero.S strcat.c strcmp.c strcpy.c strlcat.c strlcpy.c \
+ bcmp.c bzero.S strcmp.c strlcat.c strlcpy.c \
strlen.S strncmp.c \
strncpy.c htonl.S htons.S ntohl.S ntohs.S scanc.c skpc.c \
strncasecmp.c
diff --git a/sys/lib/libkern/arch/sparc64/Makefile.inc b/sys/lib/libkern/arch/sparc64/Makefile.inc
index 52c05a7295d..60ec5985400 100644
--- a/sys/lib/libkern/arch/sparc64/Makefile.inc
+++ b/sys/lib/libkern/arch/sparc64/Makefile.inc
@@ -1,11 +1,11 @@
-# $OpenBSD: Makefile.inc,v 1.4 2002/09/06 22:59:58 art Exp $
+# $OpenBSD: Makefile.inc,v 1.5 2003/06/01 17:00:31 deraadt Exp $
# $NetBSD: Makefile.inc,v 1.4 2000/11/01 19:37:20 thorpej Exp $
SRCS+= __main.c \
imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
bcmp.c ffs.S \
memchr.c memcmp.c \
- strcat.c strcmp.c strcpy.c strlen.S strlcpy.c strlcat.c \
+ strcmp.c strlen.S strlcpy.c strlcat.c \
strncasecmp.c strncmp.c strncpy.c \
scanc.c skpc.c \
htonl.S htons.S ntohl.S ntohs.S
diff --git a/sys/lib/libkern/arch/vax/Makefile.inc b/sys/lib/libkern/arch/vax/Makefile.inc
index 6ac2e2c903c..2ca3980045d 100644
--- a/sys/lib/libkern/arch/vax/Makefile.inc
+++ b/sys/lib/libkern/arch/vax/Makefile.inc
@@ -1,7 +1,7 @@
-# $OpenBSD: Makefile.inc,v 1.6 2000/12/18 18:40:47 provos Exp $
+# $OpenBSD: Makefile.inc,v 1.7 2003/06/01 17:00:32 deraadt Exp $
# $NetBSD: Makefile.inc,v 1.2 1996/04/13 01:17:58 cgd Exp $
SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
memchr.c memcmp.c \
- strcat.c strcmp.c strcpy.c strlcat.c strlcpy.c strlen.c strncmp.c \
+ strcmp.c strlcat.c strlcpy.c strlen.c strncmp.c \
strncpy.c scanc.c skpc.c strncasecmp.c
diff --git a/sys/lib/libkern/funcs.h b/sys/lib/libkern/funcs.h
new file mode 100644
index 00000000000..9312dfb7d8a
--- /dev/null
+++ b/sys/lib/libkern/funcs.h
@@ -0,0 +1,2 @@
+size_t strlcpy(char *, const char *, int);
+size_t strlcat(char *, const char *, int);
diff --git a/sys/lib/libsa/Makefile b/sys/lib/libsa/Makefile
index 0ee34dcda08..882987e6b6f 100644
--- a/sys/lib/libsa/Makefile
+++ b/sys/lib/libsa/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.20 2001/06/23 01:47:39 drahn Exp $
+# $OpenBSD: Makefile,v 1.21 2003/06/01 17:00:32 deraadt Exp $
# $NetBSD: Makefile,v 1.13 1996/10/02 16:19:51 ws Exp $
LIB= sa
@@ -25,8 +25,9 @@ CPPFLAGS+= -D__INTERNAL_LIBSA_CREAD
.endif
# stand routines
-SRCS+= alloc.c memcpy.c exit.c exec.c getfile.c gets.c globals.c printf.c \
- strerror.c strcmp.c memset.c memcmp.c strncpy.c strncmp.c strchr.c
+SRCS+= alloc.c memcpy.c exit.c exec.c getfile.c gets.c globals.c \
+ printf.c snprintf.c strerror.c strcmp.c memset.c memcmp.c \
+ strncpy.c strncmp.c strchr.c
# math from libkern
SRCS+= divdi3.c qdivrem.c
diff --git a/sys/lib/libsa/Makefile.inc b/sys/lib/libsa/Makefile.inc
index 1cf0c954a0e..5aa8a259245 100644
--- a/sys/lib/libsa/Makefile.inc
+++ b/sys/lib/libsa/Makefile.inc
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile.inc,v 1.11 2002/04/29 01:02:28 hugh Exp $
+# $OpenBSD: Makefile.inc,v 1.12 2003/06/01 17:00:32 deraadt Exp $
# $NetBSD: Makefile.inc,v 1.5 1996/09/30 16:01:18 ws Exp $
#
# NOTE: $S must correspond to the top of the 'sys' tree
@@ -31,7 +31,7 @@ ${SALIB}: .NOTMAIN __always_make_salib
@echo making sure the stand-alone library is up to date...
@${SAMAKE} libsa.a
-clean:: .NOTMAIN __always_make_salib
+clean:: .NOTMAIN __always_make_salib
@echo cleaning the stand-alone library objects
@${SAMAKE} clean
-rmdir -p ${SADST}
diff --git a/sys/lib/libsa/alloc.c b/sys/lib/libsa/alloc.c
index 34fcf0aba79..c4be3a324d3 100644
--- a/sys/lib/libsa/alloc.c
+++ b/sys/lib/libsa/alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: alloc.c,v 1.6 2002/03/14 03:16:09 millert Exp $ */
+/* $OpenBSD: alloc.c,v 1.7 2003/06/01 17:00:32 deraadt Exp $ */
/* $NetBSD: alloc.c,v 1.6 1997/02/04 18:36:33 thorpej Exp $ */
/*
@@ -40,30 +40,30 @@
* SUCH DAMAGE.
*
* @(#)alloc.c 8.1 (Berkeley) 6/11/93
- *
+ *
*
* Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Author: Alessandro Forin
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
diff --git a/sys/lib/libsa/arp.c b/sys/lib/libsa/arp.c
index aaad7fa7366..b441d77df9a 100644
--- a/sys/lib/libsa/arp.c
+++ b/sys/lib/libsa/arp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arp.c,v 1.9 2002/03/14 03:16:09 millert Exp $ */
+/* $OpenBSD: arp.c,v 1.10 2003/06/01 17:00:32 deraadt Exp $ */
/* $NetBSD: arp.c,v 1.15 1996/10/13 02:28:58 christos Exp $ */
/*
@@ -80,14 +80,14 @@ arpwhohas(d, addr)
struct ether_header eh;
struct {
struct ether_arp arp;
- u_char pad[18]; /* 60 - sizeof(...) */
+ u_char pad[18]; /* 60 - sizeof(...) */
} data;
} wbuf;
struct {
struct ether_header eh;
struct {
struct ether_arp arp;
- u_char pad[24]; /* extra space */
+ u_char pad[24]; /* extra space */
} data;
} rbuf;
@@ -103,8 +103,8 @@ arpwhohas(d, addr)
}
#ifdef ARP_DEBUG
- if (debug)
- printf("arpwhohas: send request for %s\n", inet_ntoa(addr));
+ if (debug)
+ printf("arpwhohas: send request for %s\n", inet_ntoa(addr));
#endif
bzero((char *)&wbuf.data, sizeof(wbuf.data));
@@ -132,7 +132,7 @@ arpwhohas(d, addr)
/* Store ethernet address in cache */
ah = &rbuf.data.arp;
#ifdef ARP_DEBUG
- if (debug) {
+ if (debug) {
printf("arp: response from %s\n",
ether_sprintf(rbuf.eh.ether_shost));
printf("arp: cacheing %s --> %s\n",
@@ -153,7 +153,7 @@ arpsend(d, pkt, len)
{
#ifdef ARP_DEBUG
- if (debug)
+ if (debug)
printf("arpsend: called\n");
#endif
@@ -176,7 +176,7 @@ arprecv(d, pkt, len, tleft)
u_int16_t etype; /* host order */
#ifdef ARP_DEBUG
- if (debug)
+ if (debug)
printf("arprecv: ");
#endif
@@ -244,7 +244,7 @@ arprecv(d, pkt, len, tleft)
/* We have our answer. */
#ifdef ARP_DEBUG
- if (debug)
+ if (debug)
printf("got it\n");
#endif
return (n);
diff --git a/sys/lib/libsa/bootp.c b/sys/lib/libsa/bootp.c
index 1de33af08b6..5e1eaeed887 100644
--- a/sys/lib/libsa/bootp.c
+++ b/sys/lib/libsa/bootp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bootp.c,v 1.9 2002/03/14 01:27:07 millert Exp $ */
+/* $OpenBSD: bootp.c,v 1.10 2003/06/01 17:00:32 deraadt Exp $ */
/* $NetBSD: bootp.c,v 1.10 1996/10/13 02:28:59 christos Exp $ */
/*
@@ -80,18 +80,18 @@ bootp(sock)
} rbuf;
#ifdef BOOTP_DEBUG
- if (debug)
+ if (debug)
printf("bootp: socket=%d\n", sock);
#endif
if (!bot)
bot = getsecs();
-
+
if (!(d = socktodesc(sock))) {
printf("bootp: bad socket. %d\n", sock);
return;
}
#ifdef BOOTP_DEBUG
- if (debug)
+ if (debug)
printf("bootp: d=%x\n", (u_int)d);
#endif
diff --git a/sys/lib/libsa/cd9660.c b/sys/lib/libsa/cd9660.c
index 27876855ed5..1a4c0a5b2c6 100644
--- a/sys/lib/libsa/cd9660.c
+++ b/sys/lib/libsa/cd9660.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd9660.c,v 1.8 2003/04/15 18:41:19 mickey Exp $ */
+/* $OpenBSD: cd9660.c,v 1.9 2003/06/01 17:00:32 deraadt Exp $ */
/* $NetBSD: cd9660.c,v 1.1 1996/09/30 16:01:19 ws Exp $ */
/*
@@ -81,7 +81,7 @@ pnmatch(path, pp)
{
char *cp;
int i;
-
+
cp = pp->name;
for (i = isonum_711(pp->namlen); --i >= 0; path++, cp++) {
if (toupper(*path) == *cp)
@@ -145,7 +145,7 @@ cd9660_open(path, f)
struct ptable_ent *pp;
struct iso_directory_record *dp;
int rc;
-
+
/* First find the volume descriptor */
buf = alloc(buf_size = ISO_DEFAULT_BLOCK_SIZE);
dp = (struct iso_directory_record *)buf;
@@ -170,11 +170,11 @@ cd9660_open(path, f)
}
if (isonum_723(vd->logical_block_size) != ISO_DEFAULT_BLOCK_SIZE)
goto out;
-
+
/* Now get the path table and lookup the directory of the file */
bno = isonum_732(vd->type_m_path_table);
psize = isonum_733(vd->path_table_size);
-
+
if (psize > ISO_DEFAULT_BLOCK_SIZE) {
free(buf, ISO_DEFAULT_BLOCK_SIZE);
buf = alloc(buf_size = roundup(psize, ISO_DEFAULT_BLOCK_SIZE));
@@ -189,12 +189,12 @@ cd9660_open(path, f)
rc = EIO;
goto out;
}
-
+
parent = 1;
pp = (struct ptable_ent *)buf;
ent = 1;
bno = isonum_732(pp->block) + isonum_711(pp->extlen);
-
+
rc = ENOENT;
/*
* Remove extra separators
@@ -261,7 +261,7 @@ cd9660_open(path, f)
rc = ENOENT;
goto out;
}
-
+
/* allocate file system specific data structure */
fp = alloc(sizeof(struct file));
bzero(fp, sizeof(struct file));
@@ -271,14 +271,14 @@ cd9660_open(path, f)
fp->bno = isonum_733(dp->extent);
fp->size = isonum_733(dp->size);
free(buf, buf_size);
-
+
return 0;
-
+
out:
if (fp)
free(fp, sizeof(struct file));
free(buf, buf_size);
-
+
return rc;
}
@@ -287,10 +287,10 @@ cd9660_close(f)
struct open_file *f;
{
struct file *fp = (struct file *)f->f_fsdata;
-
+
f->f_fsdata = 0;
free(fp, sizeof *fp);
-
+
return 0;
}
@@ -307,7 +307,7 @@ cd9660_read(f, start, size, resid)
char buf[ISO_DEFAULT_BLOCK_SIZE];
char *dp;
size_t read, off;
-
+
while (size) {
if (fp->off < 0 || fp->off >= fp->size)
break;
@@ -317,7 +317,7 @@ cd9660_read(f, start, size, resid)
dp = buf;
else
dp = start;
- twiddle();
+ twiddle();
rc = f->f_dev->dv_strategy(f->f_devdata, F_READ, cdb2devb(bno),
ISO_DEFAULT_BLOCK_SIZE, dp, &read);
if (rc)
@@ -361,7 +361,7 @@ cd9660_seek(f, offset, where)
int where;
{
struct file *fp = (struct file *)f->f_fsdata;
-
+
switch (where) {
case SEEK_SET:
fp->off = offset;
@@ -384,7 +384,7 @@ cd9660_stat(f, sb)
struct stat *sb;
{
struct file *fp = (struct file *)f->f_fsdata;
-
+
/* only importatn stuff */
sb->st_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH;
sb->st_uid = sb->st_gid = 0;
diff --git a/sys/lib/libsa/close.c b/sys/lib/libsa/close.c
index cc9876fa9c1..9f399b8ea0e 100644
--- a/sys/lib/libsa/close.c
+++ b/sys/lib/libsa/close.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: close.c,v 1.5 1997/02/06 02:56:44 downsj Exp $ */
+/* $OpenBSD: close.c,v 1.6 2003/06/01 17:00:32 deraadt Exp $ */
/* $NetBSD: close.c,v 1.5 1995/09/06 19:53:29 pk Exp $ */
/*-
@@ -37,30 +37,30 @@
* SUCH DAMAGE.
*
* @(#)close.c 8.1 (Berkeley) 6/11/93
- *
+ *
*
* Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Author: Alessandro Forin
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
diff --git a/sys/lib/libsa/closeall.c b/sys/lib/libsa/closeall.c
index c0a149b1368..c330ae8fb17 100644
--- a/sys/lib/libsa/closeall.c
+++ b/sys/lib/libsa/closeall.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: closeall.c,v 1.2 1996/09/23 14:18:50 mickey Exp $ */
+/* $OpenBSD: closeall.c,v 1.3 2003/06/01 17:00:32 deraadt Exp $ */
/* $NetBSD: close.c,v 1.5 1995/09/06 19:53:29 pk Exp $ */
/*-
@@ -37,30 +37,30 @@
* SUCH DAMAGE.
*
* @(#)close.c 8.1 (Berkeley) 6/11/93
- *
+ *
*
* Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Author: Alessandro Forin
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
diff --git a/sys/lib/libsa/ctime.c b/sys/lib/libsa/ctime.c
index d98ab1a013f..9d44dead949 100644
--- a/sys/lib/libsa/ctime.c
+++ b/sys/lib/libsa/ctime.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ctime.c,v 1.2 1998/06/11 01:34:10 mickey Exp $ */
+/* $OpenBSD: ctime.c,v 1.3 2003/06/01 17:00:32 deraadt Exp $ */
/*
* Copyright (c) 1998 Michael Shalayeff
@@ -73,7 +73,7 @@ ctime(clock)
tt--;
/* no field widths in printf() */
- sprintf(buf, "%s %s %d %d:%d:%d %d\n",
+ snprintf(buf, sizeof buf, "%s %s %d %d:%d:%d %d\n",
((wday < 0 || wday >= 7)? "???": wdays[wday]),
((month < 0 || month >= 12)? "???": months[month]),
(int)tt, hh, mm, ss, year);
diff --git a/sys/lib/libsa/ether.c b/sys/lib/libsa/ether.c
index b8c9bc4206d..69773361022 100644
--- a/sys/lib/libsa/ether.c
+++ b/sys/lib/libsa/ether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ether.c,v 1.5 1998/02/23 20:32:23 niklas Exp $ */
+/* $OpenBSD: ether.c,v 1.6 2003/06/01 17:00:32 deraadt Exp $ */
/* $NetBSD: ether.c,v 1.8 1996/10/13 02:29:00 christos Exp $ */
/*
@@ -67,7 +67,7 @@ sendether(d, pkt, len, dea, etype)
register struct ether_header *eh;
#ifdef ETHER_DEBUG
- if (debug)
+ if (debug)
printf("sendether: called\n");
#endif
@@ -103,7 +103,7 @@ readether(d, pkt, len, tleft, etype)
register struct ether_header *eh;
#ifdef ETHER_DEBUG
- if (debug)
+ if (debug)
printf("readether: called\n");
#endif
diff --git a/sys/lib/libsa/exec.c b/sys/lib/libsa/exec.c
index 498d6fdcc1b..236247058a0 100644
--- a/sys/lib/libsa/exec.c
+++ b/sys/lib/libsa/exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec.c,v 1.22 1998/07/14 14:26:18 mickey Exp $ */
+/* $OpenBSD: exec.c,v 1.23 2003/06/01 17:00:32 deraadt Exp $ */
/* $NetBSD: exec.c,v 1.15 1996/10/13 02:29:01 christos Exp $ */
/*-
@@ -138,7 +138,7 @@ exec(path, loadaddr, howto)
sz = i - sizeof(int);
addr += sizeof(int);
if (read(io, addr, sz) != sz)
- goto shread;
+ goto shread;
addr += sz;
}
@@ -166,7 +166,7 @@ exec(path, loadaddr, howto)
#ifdef EXEC_DEBUG
printf("loadaddr=%p etxt=%p daddr=%p ssym=%p esym=%p\n",
- loadaddr, etxt, daddr, ssym, esym);
+ loadaddr, etxt, daddr, ssym, esym);
printf("\n\nReturn to boot...\n");
getchar();
#endif
diff --git a/sys/lib/libsa/exit.c b/sys/lib/libsa/exit.c
index d1b22eb9afe..b4503f7860c 100644
--- a/sys/lib/libsa/exit.c
+++ b/sys/lib/libsa/exit.c
@@ -1,10 +1,10 @@
-/* $OpenBSD: exit.c,v 1.6 2002/03/15 18:19:52 millert Exp $ */
+/* $OpenBSD: exit.c,v 1.7 2003/06/01 17:00:32 deraadt Exp $ */
/* $NetBSD: exit.c,v 1.11 1996/12/01 20:22:19 pk Exp $ */
/*-
* Copyright (c) 1993 John Brezak
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -15,7 +15,7 @@
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR `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
@@ -36,26 +36,26 @@
__dead void
panic(const char *fmt, ...)
{
- extern void closeall(void);
- va_list ap;
- static int paniced;
-
- if (!paniced) {
- paniced = 1;
- closeall();
- }
+ extern void closeall(void);
+ va_list ap;
+ static int paniced;
- va_start(ap, fmt);
- vprintf(fmt, ap);
- printf("\n");
- va_end(ap);
- _rtt();
- /*NOTREACHED*/
+ if (!paniced) {
+ paniced = 1;
+ closeall();
+ }
+
+ va_start(ap, fmt);
+ vprintf(fmt, ap);
+ printf("\n");
+ va_end(ap);
+ _rtt();
+ /*NOTREACHED*/
}
void
exit()
{
- panic("exit");
- /*NOTREACHED*/
+ panic("exit");
+ /*NOTREACHED*/
}
diff --git a/sys/lib/libsa/ioctl.c b/sys/lib/libsa/ioctl.c
index ac2a7b2f4b4..25ea2d83b8a 100644
--- a/sys/lib/libsa/ioctl.c
+++ b/sys/lib/libsa/ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ioctl.c,v 1.2 1996/09/23 14:18:55 mickey Exp $ */
+/* $OpenBSD: ioctl.c,v 1.3 2003/06/01 17:00:32 deraadt Exp $ */
/* $NetBSD: ioctl.c,v 1.4 1994/10/30 21:48:24 cgd Exp $ */
/*-
@@ -37,30 +37,30 @@
* SUCH DAMAGE.
*
* @(#)ioctl.c 8.1 (Berkeley) 6/11/93
- *
+ *
*
* Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Author: Alessandro Forin
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
diff --git a/sys/lib/libsa/iodesc.h b/sys/lib/libsa/iodesc.h
index d32a2842426..3e372499a28 100644
--- a/sys/lib/libsa/iodesc.h
+++ b/sys/lib/libsa/iodesc.h
@@ -1,8 +1,8 @@
-/* $OpenBSD: iodesc.h,v 1.2 1996/09/23 14:18:56 mickey Exp $ */
+/* $OpenBSD: iodesc.h,v 1.3 2003/06/01 17:00:32 deraadt Exp $ */
/* $NetBSD: iodesc.h,v 1.4 1995/09/23 03:31:50 gwr Exp $ */
/*
- * Copyright (c) 1993 Adam Glass
+ * Copyright (c) 1993 Adam Glass
* Copyright (c) 1992 Regents of the University of California.
* All rights reserved.
*
diff --git a/sys/lib/libsa/loadfile.c b/sys/lib/libsa/loadfile.c
index 6262f0a0d2c..34916ab79ab 100644
--- a/sys/lib/libsa/loadfile.c
+++ b/sys/lib/libsa/loadfile.c
@@ -1,5 +1,5 @@
/* $NetBSD: loadfile.c,v 1.10 2000/12/03 02:53:04 tsutsui Exp $ */
-/* $OpenBSD: loadfile.c,v 1.4 2003/05/07 18:11:37 mickey Exp $ */
+/* $OpenBSD: loadfile.c,v 1.5 2003/06/01 17:00:32 deraadt Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -127,7 +127,7 @@ loadfile(fname, marks, flags)
#ifdef BOOT_AOUT
struct exec aout;
#endif
-
+
} hdr;
ssize_t nr;
int fd, rval;
@@ -457,7 +457,7 @@ aout_exec(fd, x, marks, flags)
sub = 0;
else
sub = sizeof(*x);
-
+
minp = maxp = ALIGNENTRY(entry);
if (lseek(fd, sizeof(*x), SEEK_SET) == -1) {
diff --git a/sys/lib/libsa/lseek.c b/sys/lib/libsa/lseek.c
index e15f1a534a7..db8804292fa 100644
--- a/sys/lib/libsa/lseek.c
+++ b/sys/lib/libsa/lseek.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lseek.c,v 1.4 1997/02/06 02:56:45 downsj Exp $ */
+/* $OpenBSD: lseek.c,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */
/* $NetBSD: lseek.c,v 1.3 1996/06/21 20:09:03 pk Exp $ */
/*-
@@ -37,30 +37,30 @@
* SUCH DAMAGE.
*
* @(#)lseek.c 8.1 (Berkeley) 6/11/93
- *
+ *
*
* Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Author: Alessandro Forin
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
diff --git a/sys/lib/libsa/net.c b/sys/lib/libsa/net.c
index 35adb509fbd..c3ebf23d289 100644
--- a/sys/lib/libsa/net.c
+++ b/sys/lib/libsa/net.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: net.c,v 1.11 2002/03/14 01:27:07 millert Exp $ */
+/* $OpenBSD: net.c,v 1.12 2003/06/01 17:00:33 deraadt Exp $ */
/* $NetBSD: net.c,v 1.14 1996/10/13 02:29:02 christos Exp $ */
/*
@@ -72,7 +72,7 @@ sendudp(d, pkt, len)
struct ip tip;
#ifdef NET_DEBUG
- if (debug) {
+ if (debug) {
printf("sendudp: d=%x called.\n", (u_int)d);
if (d) {
printf("saddr: %s:%d",
diff --git a/sys/lib/libsa/net.h b/sys/lib/libsa/net.h
index 33f1847875d..efd33d52424 100644
--- a/sys/lib/libsa/net.h
+++ b/sys/lib/libsa/net.h
@@ -1,8 +1,8 @@
-/* $OpenBSD: net.h,v 1.5 2002/03/14 03:16:10 millert Exp $ */
+/* $OpenBSD: net.h,v 1.6 2003/06/01 17:00:33 deraadt Exp $ */
/* $NetBSD: net.h,v 1.10 1995/10/20 00:46:30 cgd Exp $ */
/*
- * Copyright (c) 1993 Adam Glass
+ * Copyright (c) 1993 Adam Glass
* Copyright (c) 1992 Regents of the University of California.
* All rights reserved.
*
diff --git a/sys/lib/libsa/netif.c b/sys/lib/libsa/netif.c
index 8adafa0913f..58d067e4e84 100644
--- a/sys/lib/libsa/netif.c
+++ b/sys/lib/libsa/netif.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: netif.c,v 1.6 1999/01/11 05:12:26 millert Exp $ */
+/* $OpenBSD: netif.c,v 1.7 2003/06/01 17:00:33 deraadt Exp $ */
/* $NetBSD: netif.c,v 1.7 1996/10/13 02:29:03 christos Exp $ */
/*
@@ -60,7 +60,7 @@ netif_init()
{
struct netif_driver *drv;
int d, i;
-
+
#ifdef NETIF_DEBUG
if (netif_debug)
printf("netif_init: called\n");
@@ -113,7 +113,7 @@ netif_select(machdep_hint)
for (u = 0; u < drv->netif_nifs; u++) {
cur_if.nif_unit = u;
unit_done = 0;
-
+
#ifdef NETIF_DEBUG
if (netif_debug)
printf("\t%s%d:", drv->netif_bname,
@@ -189,14 +189,14 @@ netif_attach(nif, desc, machdep_hint)
if (netif_debug)
printf("%s%d: netif_attach\n", drv->netif_bname, nif->nif_unit);
#endif
- desc->io_netif = nif;
+ desc->io_netif = nif;
#ifdef PARANOID
if (drv->netif_init == NULL)
panic("%s%d: no netif_init support", drv->netif_bname,
nif->nif_unit);
#endif
drv->netif_init(desc, machdep_hint);
- bzero(drv->netif_ifs[nif->nif_unit].dif_stats,
+ bzero(drv->netif_ifs[nif->nif_unit].dif_stats,
sizeof(struct netif_stats));
}
@@ -297,7 +297,7 @@ netif_open(machdep_hint)
int fd;
register struct iodesc *s;
struct netif *nif;
-
+
/* find a free socket */
for (fd = 0, s = sockets; fd < SOPEN_MAX; fd++, s++)
if (s->io_netif == (struct netif *)0)
@@ -309,7 +309,7 @@ fnd:
bzero(s, sizeof(*s));
netif_init();
nif = netif_select(machdep_hint);
- if (!nif)
+ if (!nif)
panic("netboot: no interfaces left untried");
if (netif_probe(nif, machdep_hint)) {
printf("netboot: couldn't probe %s%d\n",
diff --git a/sys/lib/libsa/netif.h b/sys/lib/libsa/netif.h
index a9c87d47c36..622cb486477 100644
--- a/sys/lib/libsa/netif.h
+++ b/sys/lib/libsa/netif.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: netif.h,v 1.4 2002/03/14 01:27:07 millert Exp $ */
+/* $OpenBSD: netif.h,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */
/* $NetBSD: netif.h,v 1.4 1995/09/14 23:45:30 pk Exp $ */
#ifndef __SYS_LIBNETBOOT_NETIF_H
@@ -60,5 +60,5 @@ int netif_open(void *);
int netif_close(int);
struct iodesc *socktodesc(int);
-
+
#endif /* __SYS_LIBNETBOOT_NETIF_H */
diff --git a/sys/lib/libsa/nfs.c b/sys/lib/libsa/nfs.c
index 309afb4adc1..d103b186c74 100644
--- a/sys/lib/libsa/nfs.c
+++ b/sys/lib/libsa/nfs.c
@@ -1,10 +1,10 @@
-/* $OpenBSD: nfs.c,v 1.8 1997/03/25 20:30:43 niklas Exp $ */
+/* $OpenBSD: nfs.c,v 1.9 2003/06/01 17:00:33 deraadt Exp $ */
/* $NetBSD: nfs.c,v 1.19 1996/10/13 02:29:04 christos Exp $ */
/*-
* Copyright (c) 1993 John Brezak
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -15,7 +15,7 @@
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR `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
@@ -126,7 +126,7 @@ nfs_getrootfh(d, path, fhp)
struct repl d;
} rdata;
size_t cc;
-
+
#ifdef NFS_DEBUG
if (debug)
printf("nfs_getrootfh: %s\n", path);
@@ -191,7 +191,7 @@ nfs_lookupfh(d, name, newfd)
struct repl d;
} rdata;
ssize_t cc;
-
+
#ifdef NFS_DEBUG
if (debug)
printf("lookupfh: called\n");
@@ -259,7 +259,7 @@ nfs_readlink(d, buf)
if (cc < 4)
return (EIO);
-
+
if (rdata.d.errno)
return (ntohl(rdata.d.errno));
@@ -390,8 +390,8 @@ nfs_open(path, f)
int error = 0;
#ifdef NFS_DEBUG
- if (debug)
- printf("nfs_open: %s\n", path);
+ if (debug)
+ printf("nfs_open: %s\n", path);
#endif
if (nfs_root_node.iodesc == NULL) {
printf("nfs_open: must mount first.\n");
@@ -400,7 +400,7 @@ nfs_open(path, f)
currfd = &nfs_root_node;
newfd = 0;
-
+
cp = path;
while (*cp) {
/*
@@ -418,18 +418,18 @@ nfs_open(path, f)
error = ENOTDIR;
goto out;
}
-
+
/* allocate file system specific data structure */
newfd = alloc(sizeof(*newfd));
newfd->iodesc = currfd->iodesc;
newfd->off = 0;
-
+
/*
* Get next component of path name.
*/
{
register int len = 0;
-
+
ncp = cp;
while ((c = *cp) != '\0' && c != '/') {
if (++len > NFS_MAXNAMLEN) {
@@ -440,19 +440,19 @@ nfs_open(path, f)
}
*cp = '\0';
}
-
+
/* lookup a file handle */
error = nfs_lookupfh(currfd, ncp, newfd);
*cp = c;
if (error)
goto out;
-
+
/*
* Check for symbolic link
*/
if (newfd->fa.fa_type == htonl(NFLNK)) {
int link_len, len;
-
+
error = nfs_readlink(newfd, linkbuf);
if (error)
goto out;
@@ -468,7 +468,7 @@ nfs_open(path, f)
bcopy(cp, &namebuf[link_len], len + 1);
bcopy(linkbuf, namebuf, link_len);
-
+
/*
* If absolute pathname, restart at root.
* If relative pathname, restart at parent directory.
@@ -482,10 +482,10 @@ nfs_open(path, f)
free(newfd, sizeof(*newfd));
newfd = 0;
-
+
continue;
}
-
+
if (currfd != &nfs_root_node)
free(currfd, sizeof(*currfd));
currfd = newfd;
@@ -499,7 +499,7 @@ out:
f->f_fsdata = (void *)currfd;
return (0);
}
-
+
#ifdef NFS_DEBUG
if (debug)
printf("nfs_open: %s lookupfh failed: %s\n",
@@ -527,7 +527,7 @@ nfs_close(f)
if (fp)
free(fp, sizeof(struct nfs_iodesc));
f->f_fsdata = (void *)0;
-
+
return (0);
}
@@ -544,7 +544,7 @@ nfs_read(f, buf, size, resid)
register struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata;
register ssize_t cc;
register char *addr = buf;
-
+
#ifdef NFS_DEBUG
if (debug)
printf("nfs_read: size=%d off=%d\n", size, (int)fp->off);
diff --git a/sys/lib/libsa/nullfs.c b/sys/lib/libsa/nullfs.c
index 6066b59e21b..84c54cf549e 100644
--- a/sys/lib/libsa/nullfs.c
+++ b/sys/lib/libsa/nullfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nullfs.c,v 1.4 1997/05/04 22:41:24 millert Exp $ */
+/* $OpenBSD: nullfs.c,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */
/* $NetBSD: open.c,v 1.9 1995/09/19 09:16:52 thorpej Exp $ */
/*-
@@ -37,30 +37,30 @@
* SUCH DAMAGE.
*
* @(#)open.c 8.1 (Berkeley) 6/11/93
- *
+ *
*
* Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Author: Alessandro Forin
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
diff --git a/sys/lib/libsa/open.c b/sys/lib/libsa/open.c
index 65306545640..f852f9c2786 100644
--- a/sys/lib/libsa/open.c
+++ b/sys/lib/libsa/open.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: open.c,v 1.7 1998/09/11 01:41:18 millert Exp $ */
+/* $OpenBSD: open.c,v 1.8 2003/06/01 17:00:33 deraadt Exp $ */
/* $NetBSD: open.c,v 1.12 1996/09/30 16:01:21 ws Exp $ */
/*-
@@ -37,30 +37,30 @@
* SUCH DAMAGE.
*
* @(#)open.c 8.1 (Berkeley) 6/11/93
- *
+ *
*
* Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Author: Alessandro Forin
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
diff --git a/sys/lib/libsa/printf.c b/sys/lib/libsa/printf.c
index 8d6d33b03da..edb396d9b09 100644
--- a/sys/lib/libsa/printf.c
+++ b/sys/lib/libsa/printf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: printf.c,v 1.18 2003/05/20 19:23:01 jason Exp $ */
+/* $OpenBSD: printf.c,v 1.19 2003/06/01 17:00:33 deraadt Exp $ */
/* $NetBSD: printf.c,v 1.10 1996/11/30 04:19:21 gwr Exp $ */
/*-
@@ -65,32 +65,8 @@
#include "stand.h"
-static void kprintn(void (*)(int), u_long, int);
-static void kdoprnt(void (*)(int), const char *, va_list);
-
-#ifndef STRIPPED
-static void sputchar(int);
-static char *sbuf;
-
-static void
-sputchar(c)
- int c;
-{
- *sbuf++ = c;
-}
-
-void
-sprintf(char *buf, const char *fmt, ...)
-{
- va_list ap;
-
- sbuf = buf;
- va_start(ap, fmt);
- kdoprnt(sputchar, fmt, ap);
- va_end(ap);
- *sbuf = '\0';
-}
-#endif /* NO_SPRINTF */
+void kprintn(void (*)(int), u_long, int);
+void kdoprnt(void (*)(int), const char *, va_list);
void
printf(const char *fmt, ...)
@@ -108,7 +84,7 @@ vprintf(const char *fmt, va_list ap)
kdoprnt(putchar, fmt, ap);
}
-static void
+void
kdoprnt(put, fmt, ap)
void (*put)(int);
const char *fmt;
@@ -201,7 +177,7 @@ reswitch: switch (ch = *fmt++) {
va_end(ap);
}
-static void
+void
kprintn(put, ul, base)
void (*put)(int);
unsigned long ul;
diff --git a/sys/lib/libsa/rarp.c b/sys/lib/libsa/rarp.c
index e022239e958..225f6e96e54 100644
--- a/sys/lib/libsa/rarp.c
+++ b/sys/lib/libsa/rarp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rarp.c,v 1.8 2002/03/14 03:16:10 millert Exp $ */
+/* $OpenBSD: rarp.c,v 1.9 2003/06/01 17:00:33 deraadt Exp $ */
/* $NetBSD: rarp.c,v 1.13 1996/10/13 02:29:05 christos Exp $ */
/*
@@ -67,19 +67,19 @@ rarp_getipaddress(sock)
u_char header[ETHER_SIZE];
struct {
struct ether_arp arp;
- u_char pad[18]; /* 60 - sizeof(arp) */
+ u_char pad[18]; /* 60 - sizeof(arp) */
} data;
} wbuf;
struct {
u_char header[ETHER_SIZE];
struct {
struct ether_arp arp;
- u_char pad[24]; /* extra space */
+ u_char pad[24]; /* extra space */
} data;
} rbuf;
#ifdef RARP_DEBUG
- if (debug)
+ if (debug)
printf("rarp: socket=%d\n", sock);
#endif
if (!(d = socktodesc(sock))) {
@@ -87,7 +87,7 @@ rarp_getipaddress(sock)
return (-1);
}
#ifdef RARP_DEBUG
- if (debug)
+ if (debug)
printf("rarp: d=%x\n", (u_int)d);
#endif
@@ -139,7 +139,7 @@ rarpsend(d, pkt, len)
{
#ifdef RARP_DEBUG
- if (debug)
+ if (debug)
printf("rarpsend: called\n");
#endif
@@ -162,7 +162,7 @@ rarprecv(d, pkt, len, tleft)
u_int16_t etype; /* host order */
#ifdef RARP_DEBUG
- if (debug)
+ if (debug)
printf("rarprecv: ");
#endif
@@ -216,7 +216,7 @@ rarprecv(d, pkt, len, tleft)
/* We have our answer. */
#ifdef RARP_DEBUG
- if (debug)
+ if (debug)
printf("got it\n");
#endif
return (n);
diff --git a/sys/lib/libsa/read.c b/sys/lib/libsa/read.c
index 3e85865d0a3..96df4d799b2 100644
--- a/sys/lib/libsa/read.c
+++ b/sys/lib/libsa/read.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: read.c,v 1.4 1997/02/06 02:56:46 downsj Exp $ */
+/* $OpenBSD: read.c,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */
/* $NetBSD: read.c,v 1.7 1996/06/21 20:29:28 pk Exp $ */
/*-
@@ -37,30 +37,30 @@
* SUCH DAMAGE.
*
* @(#)read.c 8.1 (Berkeley) 6/11/93
- *
+ *
*
* Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Author: Alessandro Forin
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
diff --git a/sys/lib/libsa/readdir.c b/sys/lib/libsa/readdir.c
index 277dfc44348..967dbe3c1bd 100644
--- a/sys/lib/libsa/readdir.c
+++ b/sys/lib/libsa/readdir.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: readdir.c,v 1.4 1997/07/21 15:43:54 mickey Exp $ */
+/* $OpenBSD: readdir.c,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -18,8 +18,8 @@
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
@@ -68,7 +68,7 @@ opendir(name)
return fd;
}
-
+
int
readdir(fd, dest)
int fd;
diff --git a/sys/lib/libsa/rpc.c b/sys/lib/libsa/rpc.c
index 8fa05ae902c..35b692bc38f 100644
--- a/sys/lib/libsa/rpc.c
+++ b/sys/lib/libsa/rpc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rpc.c,v 1.11 2002/03/14 01:27:07 millert Exp $ */
+/* $OpenBSD: rpc.c,v 1.12 2003/06/01 17:00:33 deraadt Exp $ */
/* $NetBSD: rpc.c,v 1.16 1996/10/13 02:29:06 christos Exp $ */
/*
@@ -62,7 +62,7 @@
#include "rpc.h"
struct auth_info {
- int32_t authtype; /* auth type */
+ int32_t authtype; /* auth type */
u_int32_t authlen; /* auth length */
};
@@ -76,7 +76,7 @@ struct auth_unix {
struct rpc_call {
u_int32_t rp_xid; /* request transaction id */
- int32_t rp_direction; /* call direction (0) */
+ int32_t rp_direction; /* call direction (0) */
u_int32_t rp_rpcvers; /* rpc version (2) */
u_int32_t rp_prog; /* program */
u_int32_t rp_vers; /* version */
@@ -85,8 +85,8 @@ struct rpc_call {
struct rpc_reply {
u_int32_t rp_xid; /* request transaction id */
- int32_t rp_direction; /* call direction (1) */
- int32_t rp_astatus; /* accept status (0: accepted) */
+ int32_t rp_direction; /* call direction (1) */
+ int32_t rp_astatus; /* accept status (0: accepted) */
union {
u_int32_t rpu_errno;
struct {
@@ -321,7 +321,7 @@ struct pmap_list {
struct in_addr addr; /* server, net order */
u_int prog; /* host order */
u_int vers; /* host order */
- int port; /* host order */
+ int port; /* host order */
} rpc_pmap_list[PMAP_NUM];
/* return port number in host order, or -1 */
@@ -348,7 +348,7 @@ rpc_pmap_putcache(addr, prog, vers, port)
struct in_addr addr; /* server, net order */
u_int prog; /* host order */
u_int vers; /* host order */
- int port; /* host order */
+ int port; /* host order */
{
struct pmap_list *pl;
diff --git a/sys/lib/libsa/snprintf.c b/sys/lib/libsa/snprintf.c
new file mode 100644
index 00000000000..036bab74b94
--- /dev/null
+++ b/sys/lib/libsa/snprintf.c
@@ -0,0 +1,83 @@
+/* $OpenBSD: snprintf.c,v 1.1 2003/06/01 17:00:33 deraadt Exp $ */
+/* $NetBSD: printf.c,v 1.10 1996/11/30 04:19:21 gwr Exp $ */
+
+/*-
+ * Copyright (c) 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * 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. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
+ *
+ * @(#)printf.c 8.1 (Berkeley) 6/11/93
+ */
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <machine/stdarg.h>
+
+#include "stand.h"
+
+extern void kprintn(void (*)(int), u_long, int);
+extern void kdoprnt(void (*)(int), const char *, va_list);
+
+#ifndef STRIPPED
+static void sputchar(int);
+
+static char *sbuf, *sbuf_end;
+static size_t sbuf_len;
+
+void
+sputchar(c)
+ int c;
+{
+ if (sbuf < sbuf_end)
+ *sbuf = c;
+ sbuf++;
+}
+
+int
+snprintf(char *buf, size_t len, const char *fmt, ...)
+{
+ va_list ap;
+
+ sbuf = buf;
+ sbuf_len = len;
+ sbuf_end = sbuf + len;
+ va_start(ap, fmt);
+ kdoprnt(sputchar, fmt, ap);
+ va_end(ap);
+
+ if (sbuf < sbuf_end)
+ *sbuf = '\0';
+ else if (len > 0)
+ *(sbuf_end - 1) = '\0';
+
+ return sbuf - buf;
+}
+
+#endif /* STRIPPED */
diff --git a/sys/lib/libsa/stand.h b/sys/lib/libsa/stand.h
index bd012095eea..126fe7bd039 100644
--- a/sys/lib/libsa/stand.h
+++ b/sys/lib/libsa/stand.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: stand.h,v 1.39 2002/03/15 18:19:52 millert Exp $ */
+/* $OpenBSD: stand.h,v 1.40 2003/06/01 17:00:33 deraadt Exp $ */
/* $NetBSD: stand.h,v 1.18 1996/11/30 04:35:51 gwr Exp $ */
/*-
@@ -139,7 +139,7 @@ char *getdisklabel(const char *, struct disklabel *);
u_int dkcksum(struct disklabel *);
void printf(const char *, ...);
-void sprintf(char *, const char *, ...);
+int snprintf(char *, size_t, const char *, ...);
void vprintf(const char *, _BSD_VA_LIST_);
void twiddle(void);
void gets(char *);
@@ -195,7 +195,7 @@ u_int sleep(u_int);
void usleep(u_int);
char *ctime(const time_t *);
-void putchar(int);
+void putchar(int);
int getchar(void);
#ifdef __INTERNAL_LIBSA_CREAD
diff --git a/sys/lib/libsa/strcmp.c b/sys/lib/libsa/strcmp.c
index ac5a812aa37..0c2cf99ab90 100644
--- a/sys/lib/libsa/strcmp.c
+++ b/sys/lib/libsa/strcmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strcmp.c,v 1.2 1996/10/16 11:32:07 mickey Exp $ */
+/* $OpenBSD: strcmp.c,v 1.3 2003/06/01 17:00:33 deraadt Exp $ */
/*-
* Copyright (c) 1996 Michael Shalayeff
@@ -18,8 +18,8 @@
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
diff --git a/sys/lib/libsa/strerror.c b/sys/lib/libsa/strerror.c
index d39aea7059e..04f2fbe4720 100644
--- a/sys/lib/libsa/strerror.c
+++ b/sys/lib/libsa/strerror.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strerror.c,v 1.5 1997/06/10 16:39:16 millert Exp $ */
+/* $OpenBSD: strerror.c,v 1.6 2003/06/01 17:00:33 deraadt Exp $ */
/* $NetBSD: strerror.c,v 1.11 1996/10/13 02:29:08 christos Exp $ */
/*-
@@ -42,7 +42,7 @@ char *
strerror(err)
int err;
{
-static char ebuf[64];
+ static char ebuf[64];
switch (err) {
case EADAPT:
@@ -75,7 +75,7 @@ static char ebuf[64];
return "Invalid argument";
default:
- sprintf(ebuf, "Unknown error: code %d", err);
+ snprintf(ebuf, sizeof ebuf, "Unknown error: code %d", err);
return ebuf;
}
}
diff --git a/sys/lib/libsa/strncmp.c b/sys/lib/libsa/strncmp.c
index d55d73f9a3f..c0487c65ea9 100644
--- a/sys/lib/libsa/strncmp.c
+++ b/sys/lib/libsa/strncmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strncmp.c,v 1.1 1997/02/06 06:47:00 mickey Exp $ */
+/* $OpenBSD: strncmp.c,v 1.2 2003/06/01 17:00:33 deraadt Exp $ */
/*-
* Copyright (c) 1996 Michael Shalayeff
@@ -18,8 +18,8 @@
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
diff --git a/sys/lib/libsa/strncpy.c b/sys/lib/libsa/strncpy.c
index 2f09aeb2127..69795eae3b1 100644
--- a/sys/lib/libsa/strncpy.c
+++ b/sys/lib/libsa/strncpy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strncpy.c,v 1.1 1996/10/16 11:32:07 mickey Exp $ */
+/* $OpenBSD: strncpy.c,v 1.2 2003/06/01 17:00:33 deraadt Exp $ */
/*-
* Copyright (c) 1996 Michael Shalayeff
@@ -18,8 +18,8 @@
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
diff --git a/sys/lib/libsa/ufs.c b/sys/lib/libsa/ufs.c
index 9ac3a3092ca..4cc342b47d8 100644
--- a/sys/lib/libsa/ufs.c
+++ b/sys/lib/libsa/ufs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ufs.c,v 1.13 2002/03/14 01:27:07 millert Exp $ */
+/* $OpenBSD: ufs.c,v 1.14 2003/06/01 17:00:33 deraadt Exp $ */
/* $NetBSD: ufs.c,v 1.16 1996/09/30 16:01:22 ws Exp $ */
/*-
@@ -35,30 +35,30 @@
* 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.
- *
+ *
*
* Copyright (c) 1990, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Author: David Golub
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
@@ -125,8 +125,8 @@ read_inode(inumber, f)
buf = alloc(fs->fs_bsize);
twiddle();
rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
- fsbtodb(fs, ino_to_fsba(fs, inumber)), fs->fs_bsize,
- buf, &rsize);
+ fsbtodb(fs, ino_to_fsba(fs, inumber)), fs->fs_bsize,
+ buf, &rsize);
if (rc)
goto out;
if (rsize != (size_t)fs->fs_bsize) {
@@ -153,7 +153,7 @@ read_inode(inumber, f)
}
out:
free(buf, fs->fs_bsize);
- return (rc);
+ return (rc);
}
/*
@@ -232,13 +232,11 @@ block_map(f, file_block, disk_block_p)
if (fp->f_blkno[level] != ind_block_num) {
if (fp->f_blk[level] == (char *)0)
fp->f_blk[level] =
- alloc(fs->fs_bsize);
+ alloc(fs->fs_bsize);
twiddle();
rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
- fsbtodb(fp->f_fs, ind_block_num),
- fs->fs_bsize,
- fp->f_blk[level],
- &fp->f_blksize[level]);
+ fsbtodb(fp->f_fs, ind_block_num), fs->fs_bsize,
+ fp->f_blk[level], &fp->f_blksize[level]);
if (rc)
return (rc);
if (fp->f_blksize[level] != (size_t)fs->fs_bsize)
@@ -298,8 +296,8 @@ buf_read_file(f, buf_p, size_p)
} else {
twiddle();
rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
- fsbtodb(fs, disk_block),
- block_size, fp->f_buf, &fp->f_buf_size);
+ fsbtodb(fs, disk_block),
+ block_size, fp->f_buf, &fp->f_buf_size);
if (rc)
return (rc);
}
@@ -404,7 +402,7 @@ ufs_open(path, f)
fp->f_fs = fs;
twiddle();
rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ,
- SBLOCK, SBSIZE, (char *)fs, &buf_size);
+ SBLOCK, SBSIZE, (char *)fs, &buf_size);
if (rc)
goto out;
@@ -507,7 +505,7 @@ ufs_open(path, f)
if (link_len < fs->fs_maxsymlinklen) {
bcopy(fp->f_di.di_shortlink, namebuf,
- (unsigned) link_len);
+ (unsigned) link_len);
} else {
/*
* Read file for symbolic link
@@ -521,11 +519,11 @@ ufs_open(path, f)
rc = block_map(f, (daddr_t)0, &disk_block);
if (rc)
goto out;
-
+
twiddle();
rc = (f->f_dev->dv_strategy)(f->f_devdata,
- F_READ, fsbtodb(fs, disk_block),
- fs->fs_bsize, buf, &buf_size);
+ F_READ, fsbtodb(fs, disk_block),
+ fs->fs_bsize, buf, &buf_size);
if (rc)
goto out;
@@ -707,7 +705,7 @@ ufs_readdir(f, name)
while (dp < edp && dp->d_ino == (ino_t)0)
dp = (struct direct *)((char *)dp + dp->d_reclen);
fp->f_seekp += buf_size -
- ((u_int8_t *)edp - (u_int8_t *)dp);
+ ((u_int8_t *)edp - (u_int8_t *)dp);
} while (dp >= edp);
#if BYTE_ORDER == LITTLE_ENDIAN
diff --git a/sys/lib/libsa/unixdev.c b/sys/lib/libsa/unixdev.c
index 396ddb3510e..52ae1130e33 100644
--- a/sys/lib/libsa/unixdev.c
+++ b/sys/lib/libsa/unixdev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: unixdev.c,v 1.4 1998/05/25 18:37:30 mickey Exp $ */
+/* $OpenBSD: unixdev.c,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */
/*
* Copyright (c) 1996-1998 Michael Shalayeff
@@ -18,8 +18,8 @@
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
@@ -56,11 +56,11 @@ unixstrategy(devdata, rw, blk, size, buf, rsize)
#ifdef UNIX_DEBUG
printf("unixstrategy: %s %d bytes @ %d\n",
- (rw==F_READ?"reading":"writing"), size, blk);
+ (rw==F_READ?"reading":"writing"), size, blk);
#endif
if ((rc = ulseek((int)devdata, blk * DEV_BSIZE, 0)) >= 0)
- rc = rw==F_READ? uread((int)devdata, buf, size) :
- uwrite((int)devdata, buf, size);
+ rc = (rw==F_READ) ? uread((int)devdata, buf, size) :
+ uwrite((int)devdata, buf, size);
if (rc >= 0) {
*rsize = (size_t)rc;
@@ -88,7 +88,8 @@ unixopen(struct open_file *f, ...)
if (strncmp("/dev/", *file, 5) == 0) {
/* p = strchr(p + 5, '/') */
- for (p = *file + 5; *p != '\0' && *p != '/'; p++);
+ for (p = *file + 5; *p != '\0' && *p != '/'; p++)
+ ;
if (*p == '/')
*p = '\0';
}
@@ -99,7 +100,7 @@ unixopen(struct open_file *f, ...)
if (p != NULL)
*p = '/';
- return fd<0? -1: 0;
+ return fd < 0 ? -1 : 0;
}
int
@@ -171,6 +172,7 @@ unix_getc(dev)
return 1;
} else {
char c;
+
return uread(0, &c, 1)<1? -1: c;
}
}
diff --git a/sys/lib/libsa/unixdev.h b/sys/lib/libsa/unixdev.h
index 126cccd336b..033c0315571 100644
--- a/sys/lib/libsa/unixdev.h
+++ b/sys/lib/libsa/unixdev.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: unixdev.h,v 1.4 2002/03/14 01:27:07 millert Exp $ */
+/* $OpenBSD: unixdev.h,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */
/*
* Copyright (c) 1996 Michael Shalayeff
@@ -18,8 +18,8 @@
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
diff --git a/sys/lib/libsa/write.c b/sys/lib/libsa/write.c
index ead77c74710..0cb9e540ae3 100644
--- a/sys/lib/libsa/write.c
+++ b/sys/lib/libsa/write.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: write.c,v 1.3 1996/12/08 15:15:59 niklas Exp $ */
+/* $OpenBSD: write.c,v 1.4 2003/06/01 17:00:33 deraadt Exp $ */
/* $NetBSD: write.c,v 1.7 1996/06/21 20:29:30 pk Exp $ */
/*-
@@ -37,30 +37,30 @@
* SUCH DAMAGE.
*
* @(#)write.c 8.1 (Berkeley) 6/11/93
- *
+ *
*
* Copyright (c) 1989, 1990, 1991 Carnegie Mellon University
* All Rights Reserved.
*
* Author: Alessandro Forin
- *
+ *
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
- *
+ *
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
+ *
* Carnegie Mellon requests users of this software to return to
- *
+ *
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
- *
+ *
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
@@ -84,7 +84,7 @@ write(fd, dest, bcount)
if (f->f_flags & F_RAW) {
twiddle();
errno = (f->f_dev->dv_strategy)(f->f_devdata, F_WRITE,
- btodb(f->f_offset), bcount, dest, &resid);
+ btodb(f->f_offset), bcount, dest, &resid);
if (errno)
return (-1);
f->f_offset += resid;
diff --git a/sys/stand/boot/boot.c b/sys/stand/boot/boot.c
index 844f36f2439..86374e2cdb0 100644
--- a/sys/stand/boot/boot.c
+++ b/sys/stand/boot/boot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: boot.c,v 1.26 2003/05/19 08:18:25 mickey Exp $ */
+/* $OpenBSD: boot.c,v 1.27 2003/06/01 17:00:26 deraadt Exp $ */
/*
* Copyright (c) 2003 Dale Rahn
@@ -19,8 +19,8 @@
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
@@ -38,10 +38,10 @@
#include <sys/stat.h>
#include <libsa.h>
#include <lib/libsa/loadfile.h>
+#include <lib/libkern/funcs.h>
#include "cmd.h"
-
static const char *const kernels[] = {
"/bsd",
"/obsd",
@@ -66,7 +66,7 @@ boot(bootdev)
printf(">> OpenBSD/" MACHINE " BOOT %s\n", version);
devboot(bootdev, cmd.bootdev);
- strncpy(cmd.image, bootfile, sizeof(cmd.image));
+ strlcpy(cmd.image, bootfile, sizeof(cmd.image));
cmd.boothowto = 0;
cmd.conf = "/etc/boot.conf";
cmd.addr = (void *)DEFAULT_KERNEL_ADDRESS;
@@ -74,7 +74,8 @@ boot(bootdev)
st = read_conf();
if (!bootprompt)
- sprintf(cmd.path, "%s:%s", cmd.bootdev, cmd.image);
+ snprintf(cmd.path, sizeof cmd.path, "%s:%s",
+ cmd.bootdev, cmd.image);
while (1) {
/* no boot.conf, or no boot cmd in there */
@@ -95,7 +96,7 @@ boot(bootdev)
bootfile = kernels[i=0];
} else
bootfile = kernels[i];
- strncpy(cmd.image, bootfile, sizeof(cmd.image));
+ strlcpy(cmd.image, bootfile, sizeof(cmd.image));
printf(" failed(%d). will try %s\n", errno, bootfile);
if (try < 2)
diff --git a/sys/stand/boot/bootarg.c b/sys/stand/boot/bootarg.c
index dd3f96ee081..fba2fbf9def 100644
--- a/sys/stand/boot/bootarg.c
+++ b/sys/stand/boot/bootarg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bootarg.c,v 1.7 2002/03/14 03:16:12 millert Exp $ */
+/* $OpenBSD: bootarg.c,v 1.8 2003/06/01 17:00:27 deraadt Exp $ */
/*
* Copyright (c) 1997,1998 Michael Shalayeff
@@ -18,8 +18,8 @@
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
diff --git a/sys/stand/boot/bootarg.h b/sys/stand/boot/bootarg.h
index 414cf7a8e27..40baf3bd663 100644
--- a/sys/stand/boot/bootarg.h
+++ b/sys/stand/boot/bootarg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bootarg.h,v 1.9 2002/03/14 01:27:13 millert Exp $ */
+/* $OpenBSD: bootarg.h,v 1.10 2003/06/01 17:00:27 deraadt Exp $ */
/*
* Copyright (c) 1996-1999 Michael Shalayeff
@@ -50,7 +50,7 @@ typedef struct _boot_args {
#if defined(_KERNEL) || defined(_STANDALONE)
extern void *bootargv;
-extern int bootargc;
+extern int bootargc;
extern bootarg_t *bootargp;
#endif
diff --git a/sys/stand/boot/cmd.c b/sys/stand/boot/cmd.c
index df2f83ddf08..212ba28a008 100644
--- a/sys/stand/boot/cmd.c
+++ b/sys/stand/boot/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.48 2002/07/14 09:19:17 mdw Exp $ */
+/* $OpenBSD: cmd.c,v 1.49 2003/06/01 17:00:27 deraadt Exp $ */
/*
* Copyright (c) 1997-1999 Michael Shalayeff
@@ -18,8 +18,8 @@
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
@@ -35,6 +35,7 @@
#include <sys/param.h>
#include <libsa.h>
#include <sys/reboot.h>
+#include <lib/libkern/funcs.h>
#include "cmd.h"
#define CTRL(c) ((c)&0x1f)
@@ -122,9 +123,9 @@ read_conf()
cmd.cmd = NULL;
- do
+ do {
eof = read(fd, p, 1);
- while (eof > 0 && *p++ != '\n');
+ } while (eof > 0 && *p++ != '\n');
if (eof < 0)
printf("%s: %s\n", cmd.path, strerror(errno));
@@ -239,12 +240,13 @@ readline(buf, n, to)
break;
if (!cnischar()) {
- strncpy(buf, "boot", 5);
+ strlcpy(buf, "boot", 5);
putchar('\n');
return strlen(buf);
}
} else
- while (!cnischar()) ;
+ while (!cnischar())
+ ;
while (1) {
switch ((ch = getchar())) {
@@ -283,7 +285,7 @@ readline(buf, n, to)
/*
* Search for spaces/tabs after the current word. If found, \0 the
* first one. Then pass a pointer to the first character of the
- * next word, or NULL if there is no next word.
+ * next word, or NULL if there is no next word.
*/
char *
nextword(p)
@@ -407,7 +409,8 @@ Xls()
}
/* no strlen in lib !!! */
- for (p = cmd.path; *p; p++);
+ for (p = cmd.path; *p; p++)
+ ;
*p++ = '/';
*p = '\0';
@@ -439,7 +442,7 @@ ls(name, sb)
lsrwx(sb->st_mode , (sb->st_mode & S_ISTXT? "tT" : "x-"));
printf (" %u,%u\t%lu\t%s\n", sb->st_uid, sb->st_gid,
- (u_long)sb->st_size, name);
+ (u_long)sb->st_size, name);
}
#undef lsrwx
@@ -466,7 +469,8 @@ Xboot()
} else {
if (bootparse(1))
return 0;
- sprintf(cmd.path, "%s:%s", cmd.bootdev, cmd.image);
+ snprintf(cmd.path, sizeof cmd.path, "%s:%s",
+ cmd.bootdev, cmd.image);
}
return 1;
@@ -486,9 +490,10 @@ qualify(name)
if (*p == ':')
break;
if (*p == ':')
- strncpy(cmd.path, name, sizeof(cmd.path));
+ strlcpy(cmd.path, name, sizeof(cmd.path));
else
- sprintf(cmd.path, "%s:%s", cmd.bootdev, name);
+ snprintf(cmd.path, sizeof cmd.path, "%s:%s",
+ cmd.bootdev, name);
return cmd.path;
}
diff --git a/sys/stand/boot/cmd.h b/sys/stand/boot/cmd.h
index cd8c1936b19..d27b4339ca2 100644
--- a/sys/stand/boot/cmd.h
+++ b/sys/stand/boot/cmd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.h,v 1.11 2002/03/14 01:27:13 millert Exp $ */
+/* $OpenBSD: cmd.h,v 1.12 2003/06/01 17:00:27 deraadt Exp $ */
/*
* Copyright (c) 1997 Michael Shalayeff
@@ -18,8 +18,8 @@
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
diff --git a/sys/stand/boot/vars.c b/sys/stand/boot/vars.c
index 9876b877a4d..127ef05bd1c 100644
--- a/sys/stand/boot/vars.c
+++ b/sys/stand/boot/vars.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vars.c,v 1.7 2002/03/14 01:27:13 millert Exp $ */
+/* $OpenBSD: vars.c,v 1.8 2003/06/01 17:00:27 deraadt Exp $ */
/*
* Copyright (c) 1998-2000 Michael Shalayeff
@@ -35,6 +35,7 @@
#include <sys/param.h>
#include <libsa.h>
#include <sys/reboot.h>
+#include <lib/libkern/funcs.h>
#include "cmd.h"
extern const char version[];
@@ -55,7 +56,7 @@ int Xenv(void);
const struct cmd_table cmd_set[] = {
{"addr", CMDT_VAR, Xaddr},
{"howto", CMDT_VAR, Xhowto},
-#ifdef DEBUG
+#ifdef DEBUG
{"debug", CMDT_VAR, Xdebug},
#endif
{"device", CMDT_VAR, Xdevice},
@@ -109,7 +110,7 @@ Xdevice()
if (cmd.argc != 2)
printf("%s\n", cmd.bootdev);
else
- strncpy(cmd.bootdev, cmd.argv[1], sizeof(cmd.bootdev));
+ strlcpy(cmd.bootdev, cmd.argv[1], sizeof(cmd.bootdev));
return 0;
}
@@ -119,7 +120,7 @@ Ximage()
if (cmd.argc != 2)
printf("%s\n", cmd.image);
else
- strncpy(cmd.image, cmd.argv[1], sizeof(cmd.image));
+ strlcpy(cmd.image, cmd.argv[1], sizeof(cmd.image));
return 0;
}
@@ -232,6 +233,7 @@ bootparse(i)
* terminated by the usual '\0'
*/
char *environ;
+
int
Xenv()
{
@@ -245,20 +247,23 @@ Xenv()
int l;
for (p = environ; p && *p; p = q) {
l = strlen(cmd.argv[1]);
- for (q = p; *q != '='; q++);
+ for (q = p; *q != '='; q++)
+ ;
l = max(l, q - p) + 1;
- for (q = p; *q != '\n'; q++);
+ for (q = p; *q != '\n'; q++)
+ ;
if (*q)
q++;
if (!strncmp(p, cmd.argv[1], l)) {
- while((*p++ = *q++));
+ while((*p++ = *q++))
+ ;
p--;
}
}
if (!p)
p = environ = alloc(4096);
- sprintf(p, "%s=%s\n",
- cmd.argv[1], (cmd.argc==3?cmd.argv[2]:""));
+ snprintf(p, environ + 4096 - p, "%s=%s\n",
+ cmd.argv[1], (cmd.argc==3?cmd.argv[2]:""));
}
return 0;