summaryrefslogtreecommitdiffstats
path: root/usr.sbin/boot0cfg
diff options
context:
space:
mode:
authormikeh <mikeh@FreeBSD.org>2001-12-11 06:44:29 +0000
committermikeh <mikeh@FreeBSD.org>2001-12-11 06:44:29 +0000
commitf2a2bcb9ed4d56b09bae3846eac4cfc62cdd6d58 (patch)
treeb3cc93ae219c30fe57df08e62e769b0dcd15d3f0 /usr.sbin/boot0cfg
parent46c0ef263ee8acbf06690464e2e6ec8bf9432c95 (diff)
downloadFreeBSD-src-f2a2bcb9ed4d56b09bae3846eac4cfc62cdd6d58.zip
FreeBSD-src-f2a2bcb9ed4d56b09bae3846eac4cfc62cdd6d58.tar.gz
WARNS=2 cleanup.
Submitted by: Maxime Henrion <mux@qualys.com> MFC after: 2 weeks
Diffstat (limited to 'usr.sbin/boot0cfg')
-rw-r--r--usr.sbin/boot0cfg/Makefile1
-rw-r--r--usr.sbin/boot0cfg/boot0cfg.c18
2 files changed, 12 insertions, 7 deletions
diff --git a/usr.sbin/boot0cfg/Makefile b/usr.sbin/boot0cfg/Makefile
index 623f3ee..ed5f5f6 100644
--- a/usr.sbin/boot0cfg/Makefile
+++ b/usr.sbin/boot0cfg/Makefile
@@ -1,6 +1,7 @@
# $FreeBSD$
PROG= boot0cfg
+WARNS?= 2
MAN= boot0cfg.8
.include <bsd.prog.mk>
diff --git a/usr.sbin/boot0cfg/boot0cfg.c b/usr.sbin/boot0cfg/boot0cfg.c
index dc959c0..8dfd9b1 100644
--- a/usr.sbin/boot0cfg/boot0cfg.c
+++ b/usr.sbin/boot0cfg/boot0cfg.c
@@ -92,7 +92,8 @@ main(int argc, char *argv[])
{
u_int8_t *mbr, *boot0;
int boot0_size, mbr_size;
- const char *bpath, *fpath, *disk;
+ const char *bpath, *fpath;
+ char *disk;
int B_flag, v_flag, o_flag;
int d_arg, m_arg, s_arg, t_arg;
int o_and, o_or;
@@ -201,6 +202,7 @@ main(int argc, char *argv[])
if (mbr != boot0)
free(boot0);
free(mbr);
+ free(disk);
return 0;
}
@@ -316,7 +318,7 @@ boot0version(const u_int8_t *bs)
return 0x100;
/* We have a newer boot0, so extract the version number and return it. */
- return *(int *)(bs + OFF_VERSION) & 0xffff;
+ return *(const int *)(bs + OFF_VERSION) & 0xffff;
}
/*
@@ -337,7 +339,7 @@ boot0bs(const u_int8_t *bs)
{0x0, sizeof(id0), id0},
{0x1b2, sizeof(id1), id1}
};
- int i;
+ unsigned int i;
for (i = 0; i < sizeof(ident) / sizeof(ident[0]); i++)
if (memcmp(bs + ident[i].off, ident[i].key, ident[i].len))
@@ -385,12 +387,14 @@ mkrdev(const char *fname)
char buf[MAXPATHLEN];
char *s;
- s = (char *)fname;
if (!strchr(fname, '/')) {
snprintf(buf, sizeof(buf), "%s%s", _PATH_DEV, fname);
- if (!(s = strdup(buf)))
- err(1, NULL);
- }
+ s = strdup(buf);
+ } else
+ s = strdup(fname);
+
+ if (s == NULL)
+ errx(1, "No more memory");
return s;
}
OpenPOWER on IntegriCloud