summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-02-21 22:55:20 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-02-21 22:55:20 +0000
commit8083acdd9a1ea3a77e756e9bfd28adbecc7d2438 (patch)
tree29a1385eaa6cdbf663ff42ed535ef82af9ac2b65 /sbin
parent62bcf0c332fe463c1da83a755c0dc9d783c62854 (diff)
Don't expose private copies of malloc(), calloc(), free(). Ewwww.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/newfs/mkfs.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c
index 648ea9760e2..8e3646e4325 100644
--- a/sbin/newfs/mkfs.c
+++ b/sbin/newfs/mkfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkfs.c,v 1.4 1997/02/11 07:01:37 millert Exp $ */
+/* $OpenBSD: mkfs.c,v 1.5 1997/02/21 22:55:19 millert Exp $ */
/* $NetBSD: mkfs.c,v 1.25 1995/06/18 21:35:38 cgd Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)mkfs.c 8.3 (Berkeley) 2/3/94";
#else
-static char rcsid[] = "$OpenBSD: mkfs.c,v 1.4 1997/02/11 07:01:37 millert Exp $";
+static char rcsid[] = "$OpenBSD: mkfs.c,v 1.5 1997/02/21 22:55:19 millert Exp $";
#endif
#endif /* not lint */
@@ -107,7 +107,8 @@ extern int bbsize; /* boot block size */
extern int sbsize; /* superblock size */
extern u_long memleft; /* virtual memory available */
extern caddr_t membase; /* start address of memory based filesystem */
-extern caddr_t malloc(), calloc();
+static caddr_t malloc(), calloc();
+static void free();
union {
struct fs fs;
@@ -1025,7 +1026,7 @@ started()
/*
* Replace libc function with one suited to our needs.
*/
-caddr_t
+static caddr_t
malloc(size)
register u_long size;
{
@@ -1057,7 +1058,7 @@ malloc(size)
/*
* Replace libc function with one suited to our needs.
*/
-caddr_t
+static caddr_t
realloc(ptr, size)
char *ptr;
u_long size;
@@ -1066,15 +1067,17 @@ realloc(ptr, size)
if ((p = malloc(size)) == NULL)
return (NULL);
- memcpy(p, ptr, size);
- free(ptr);
+ if (ptr) {
+ memcpy(p, ptr, size);
+ free(ptr);
+ }
return (p);
}
/*
* Replace libc function with one suited to our needs.
*/
-char *
+static char *
calloc(size, numelm)
u_long size, numelm;
{
@@ -1089,6 +1092,7 @@ calloc(size, numelm)
/*
* Replace libc function with one suited to our needs.
*/
+static void
free(ptr)
char *ptr;
{