Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/installboot add some more assert()s
details: https://anonhg.NetBSD.org/src/rev/f922e8020750
branches: trunk
changeset: 526289:f922e8020750
user: lukem <lukem%NetBSD.org@localhost>
date: Tue Apr 30 14:21:17 2002 +0000
description:
add some more assert()s
diffstat:
usr.sbin/installboot/ffs.c | 24 +++++++++++++++++++++---
usr.sbin/installboot/installboot.c | 15 ++++++++++++---
2 files changed, 33 insertions(+), 6 deletions(-)
diffs (151 lines):
diff -r 4e5196ba7aea -r f922e8020750 usr.sbin/installboot/ffs.c
--- a/usr.sbin/installboot/ffs.c Tue Apr 30 13:14:38 2002 +0000
+++ b/usr.sbin/installboot/ffs.c Tue Apr 30 14:21:17 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs.c,v 1.1 2002/04/19 07:08:51 lukem Exp $ */
+/* $NetBSD: ffs.c,v 1.2 2002/04/30 14:21:17 lukem Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: ffs.c,v 1.1 2002/04/19 07:08:51 lukem Exp $");
+__RCSID("$NetBSD: ffs.c,v 1.2 2002/04/30 14:21:17 lukem Exp $");
#endif /* !__lint */
#include <sys/param.h>
@@ -70,6 +70,8 @@
{
int rv;
+ assert(params != NULL);
+ assert(blk != NULL);
assert(params->filesystem != NULL);
assert(params->fsfd != -1);
assert(blkno > 0);
@@ -114,6 +116,10 @@
char diskbuf[MAXBSIZE];
} level[LEVELS];
+ assert(params != NULL);
+ assert(callback != NULL);
+ assert(state != NULL);
+
/* Read the superblock. */
if (! ffs_read_disk_block(params, SBLOCK, SBSIZE, sbbuf))
return (0);
@@ -244,6 +250,9 @@
struct direct *de, *ede;
uint32_t ino;
+ assert(params != NULL);
+ assert(_ino != NULL);
+
/* Skip directory holes. */
if (blk == 0)
return (1);
@@ -284,6 +293,9 @@
{
struct findblks_state *state = _state;
+ assert(params != NULL);
+ assert(_state != NULL);
+
if (state->nblk == state->maxblk) {
warnx("Secondary bootstrap `%s' has too many blocks " \
"(max %d)\n", params->stage2, state->maxblk);
@@ -303,6 +315,9 @@
char sbbuf[SBSIZE];
struct fs *fs;
+ assert(params != NULL);
+ assert(params->stage2 != NULL);
+
/* Read and check the superblock. */
if (! ffs_read_disk_block(params, SBLOCK, SBSIZE, sbbuf))
return (0);
@@ -321,7 +336,10 @@
uint32_t ino;
struct findblks_state state;
- assert (params->stage2 != NULL);
+ assert(params != NULL);
+ assert(params->stage2 != NULL);
+ assert(maxblk != NULL);
+ assert(blocks != NULL);
/* The secondary bootstrap must be clearly in /. */
if (params->stage2[0] == '/')
diff -r 4e5196ba7aea -r f922e8020750 usr.sbin/installboot/installboot.c
--- a/usr.sbin/installboot/installboot.c Tue Apr 30 13:14:38 2002 +0000
+++ b/usr.sbin/installboot/installboot.c Tue Apr 30 14:21:17 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: installboot.c,v 1.6 2002/04/19 07:08:52 lukem Exp $ */
+/* $NetBSD: installboot.c,v 1.7 2002/04/30 14:21:17 lukem Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: installboot.c,v 1.6 2002/04/19 07:08:52 lukem Exp $");
+__RCSID("$NetBSD: installboot.c,v 1.7 2002/04/30 14:21:17 lukem Exp $");
#endif /* !__lint */
#include <sys/utsname.h>
@@ -171,7 +171,7 @@
! params->fstype->match(params))
params->fstype++;
if (params->fstype->name == NULL)
- err(1, "File system `%s' is of an unknown type",
+ errx(1, "File system `%s' is of an unknown type",
params->filesystem);
}
@@ -251,6 +251,9 @@
no_parseopt(ib_params *params, const char *option)
{
+ assert(params != NULL);
+ assert(option != NULL);
+
/* all options are unsupported */
warnx("Unsupported -o option `%s'", option);
return (0);
@@ -260,6 +263,8 @@
no_setboot(ib_params *params)
{
+ assert(params != NULL);
+
/* bootstrap installation is not supported */
warnx("%s: bootstrap installation is not supported",
params->machine->name);
@@ -270,6 +275,8 @@
no_clearboot(ib_params *params)
{
+ assert(params != NULL);
+
/* bootstrap removal is not supported */
warnx("%s: bootstrap removal is not supported",
params->machine->name);
@@ -284,6 +291,7 @@
assert(param != NULL);
assert(mach != NULL);
+ assert(provider != NULL);
for (i = 0; machines[i].name != NULL; i++) {
if (strcmp(machines[i].name, mach) == 0) {
@@ -312,6 +320,7 @@
assert(param != NULL);
assert(fstype != NULL);
+ assert(provider != NULL);
for (i = 0; fstypes[i].name != NULL; i++) {
if (strcmp(fstypes[i].name, fstype) == 0) {
Home |
Main Index |
Thread Index |
Old Index