Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Jul 2001 00:05:01 -0400 (EDT)
From:      Mike Barcroft <mike@q9media.com>
To:        Mike Heffner <mheffner@novacoxmail.com>
Cc:        audit@FreeBSD.org
Subject:   Re: Teach tmpfile(3) about TMPDIR
Message-ID:  <200107060405.f66451H10795@coffee.q9media.com>

next in thread | raw e-mail | index | archive | help
Mike Heffner <mheffner@novacoxmail.com> writes:
[...]
+       buf = malloc(tmpdirlen + (tmpdir[tmpdirlen - 1] == '/') ? 0 : 1 +
+           sizeof(TRAILER));
+       if (buf == NULL)
+               return NULL;
+       (void)sprintf(buf, "%s%s%s", tmpdir,
+           (tmpdir[tmpdirlen - 1] == '/') ? "" : "/", TRAILER);
[...]

Why not use asprintf(3) instead?  Like:
(void)asprintf(&buf, "%s%s%s", tmpdir,
    (tmpdir[strlen(tmpdir) - 1] == '/') ? "" : "/", TRAILER);
if (buf == NULL)
	return NULL;


Best regards,
Mike Barcroft

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200107060405.f66451H10795>