From owner-freebsd-bugs Thu Apr 4 1:20:29 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id E0CD337B41E for ; Thu, 4 Apr 2002 01:20:04 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g349K4067318; Thu, 4 Apr 2002 01:20:04 -0800 (PST) (envelope-from gnats) Date: Thu, 4 Apr 2002 01:20:04 -0800 (PST) Message-Id: <200204040920.g349K4067318@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Peter Pentchev Subject: Re: bin/36738: [PATCH] newsyslog ownership race condition Reply-To: Peter Pentchev Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/36738; it has been noted by GNATS. From: Peter Pentchev To: Sheldon Hearn Cc: bug-followup@FreeBSD.org Subject: Re: bin/36738: [PATCH] newsyslog ownership race condition Date: Thu, 4 Apr 2002 12:17:39 +0300 On Thu, Apr 04, 2002 at 11:06:41AM +0200, Sheldon Hearn wrote: > > >Number: 36738 > >Category: bin > >Synopsis: [PATCH] newsyslog ownership race condition > >Originator: Sheldon Hearn > >Environment: > > All known versions of FreeBSD (problem existed in rev 1.1 of > newsyslog.c). [snip] > Index: newsyslog.c > =================================================================== > @@ -644,20 +645,28 @@ > if (noaction) > printf("Start new log..."); > else { > - fd = creat(log, perm); > + strlcpy(tfile, log, sizeof(tfile)); > + strlcat(tfile, ".XXXXXX", sizeof(tfile)); > + mkstemp(tfile); Minor comment: the two strl*() invocations could be replaced with a single snprintf(). Still, I could see how compatibility with OpenBSD might be important here, not to speak of the fact that an snprintf() might actually prove to be a mite slower :) Other than that, this looks fine, and useful, too! G'luck, Peter -- Peter Pentchev roam@ringlet.net roam@FreeBSD.org PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 What would this sentence be like if pi were 3? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message