From owner-freebsd-audit Fri Jul 6 16: 2:36 2001 Delivered-To: freebsd-audit@freebsd.org Received: from iatl0x01.coxmail.com (iatl0x02.coxmail.com [206.157.225.11]) by hub.freebsd.org (Postfix) with ESMTP id 2A7BB37B405 for ; Fri, 6 Jul 2001 16:02:32 -0700 (PDT) (envelope-from mheffner@novacoxmail.com) Received: from enterprise.muriel.penguinpowered.com ([208.138.198.178]) by iatl0x01.coxmail.com (InterMail vK.4.03.02.00 201-232-124 license 85f4f10023be2bd3bce00b3a38363ea2) with ESMTP id <20010706230157.VVH25345.iatl0x01@enterprise.muriel.penguinpowered.com>; Fri, 6 Jul 2001 19:01:57 -0400 Message-ID: X-Mailer: XFMail 1.5.0 on FreeBSD X-Priority: 3 (Normal) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="_=XFMail.1.5.0.FreeBSD:20010706190127:70043=_"; micalg=pgp-md5; protocol="application/pgp-signature" In-Reply-To: <200107060405.f66451H10795@coffee.q9media.com> Date: Fri, 06 Jul 2001 19:01:27 -0400 (EDT) Reply-To: Mike Heffner From: Mike Heffner To: Mike Barcroft Subject: Re: Teach tmpfile(3) about TMPDIR Cc: audit@FreeBSD.org Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This message is in MIME format --_=XFMail.1.5.0.FreeBSD:20010706190127:70043=_ Content-Type: text/plain; charset=us-ascii On 06-Jul-2001 Mike Barcroft wrote: | Mike Heffner 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; No real reason. I was a little unsure on what errno was set to, if at all, on failure (printf(3) doesn't really state anything), but looking at the code it looks like it'll only return ENOMEM, so it's probably safe to use. Mike -- Mike Heffner Fredericksburg, VA --_=XFMail.1.5.0.FreeBSD:20010706190127:70043=_ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (FreeBSD) Comment: For info see http://www.gnupg.org iD8DBQE7RkNGFokZQs3sv5kRAiZKAJ9d7aKouME/+wONsySxUt4m4A37LgCePhCg jYm8OJS7Na5K2JtOnP4y3mw= =a4WU -----END PGP SIGNATURE----- --_=XFMail.1.5.0.FreeBSD:20010706190127:70043=_-- End of MIME message To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message