Don't cast incorrectly to malloc(3), and don't use errx(3) if malloc(3)

returns NULL, as malloc(3) sets errno.  Use err(3).
This commit is contained in:
Juli Mallett 2002-05-02 05:46:37 +00:00
parent 2a688cec16
commit 3d674c947c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=95921

View file

@ -72,8 +72,8 @@ shquote(char **argv)
if (buf == NULL) {
if ((arg_max = sysconf(_SC_ARG_MAX)) == -1)
errx(1, "sysconf _SC_ARG_MAX failed");
if ((buf = malloc((u_int)(4 * arg_max) + 1)) == NULL)
errx(1, "malloc failed");
if ((buf = malloc((size_t)(4 * arg_max) + 1)) == NULL)
err(1, "malloc");
}
if (*argv == 0) {