When allocating a buffer failed, don't fail silently.

This commit is contained in:
kleink 1997-06-26 23:07:19 +00:00
parent f3efbb406a
commit b4780b53b4

View File

@ -1,4 +1,4 @@
/* $NetBSD: cat.c,v 1.13 1997/04/27 18:34:33 kleink Exp $ */
/* $NetBSD: cat.c,v 1.14 1997/06/26 23:07:19 kleink Exp $ */
/*
* Copyright (c) 1989, 1993
@ -46,7 +46,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)cat.c 8.2 (Berkeley) 4/27/95";
#else
static char rcsid[] = "$NetBSD: cat.c,v 1.13 1997/04/27 18:34:33 kleink Exp $";
static char rcsid[] = "$NetBSD: cat.c,v 1.14 1997/06/26 23:07:19 kleink Exp $";
#endif
#endif /* not lint */
@ -253,7 +253,7 @@ raw_cat(rfd)
err(1, "%s", filename);
bsize = MAX(sbuf.st_blksize, 1024);
if ((buf = malloc((u_int)bsize)) == NULL)
err(1, NULL);
err(1, "cannot allocate buffer");
}
while ((nr = read(rfd, buf, bsize)) > 0)
for (off = 0; nr; nr -= nw, off += nw)