aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/ranlib/build.c10
-rw-r--r--usr.bin/ranlib/misc.c20
2 files changed, 6 insertions, 24 deletions
diff --git a/usr.bin/ranlib/build.c b/usr.bin/ranlib/build.c
index b4d8bc69a8ee..6768257b6587 100644
--- a/usr.bin/ranlib/build.c
+++ b/usr.bin/ranlib/build.c
@@ -143,7 +143,6 @@ rexec(rfd, wfd)
struct nlist nl;
off_t r_off, w_off;
long strsize;
- void *emalloc();
/* Get current offsets for original and tmp files. */
r_off = lseek(rfd, (off_t)0, SEEK_CUR);
@@ -169,7 +168,8 @@ rexec(rfd, wfd)
/* Read in the string table. */
strsize -= sizeof(strsize);
- strtab = emalloc(strsize);
+ if ((strtab = malloc(strsize)) == NULL)
+ error(archive);
nr = read(rfd, strtab, strsize);
if (nr != strsize) {
badread: if (nr < 0)
@@ -205,8 +205,10 @@ badread: if (nr < 0)
sym = strtab + nl.n_un.n_strx - sizeof(long);
symlen = strlen(sym) + 1;
- rp = (RLIB *)emalloc(sizeof(RLIB));
- rp->sym = (char *)emalloc(symlen);
+ if ((rp = malloc(sizeof(RLIB))) == NULL)
+ error(archive);
+ if ((rp->sym = malloc(symlen)) == NULL)
+ error(archive);
bcopy(sym, rp->sym, symlen);
rp->symlen = symlen;
rp->pos = w_off;
diff --git a/usr.bin/ranlib/misc.c b/usr.bin/ranlib/misc.c
index 19b4854cbfa7..85a5f8cfbc40 100644
--- a/usr.bin/ranlib/misc.c
+++ b/usr.bin/ranlib/misc.c
@@ -79,26 +79,6 @@ tmp(void)
return(fd);
}
-void *
-emalloc(len)
- int len;
-{
- void *p;
-
- if ((p = malloc((u_int)len)) == NULL)
- error(archive);
- return(p);
-}
-
-char *
-rname(path)
- char *path;
-{
- register char *ind;
-
- return((ind = rindex(path, '/')) ? ind + 1 : path);
-}
-
void
badfmt(void)
{