Date: Thu, 4 Apr 2002 01:20:04 -0800 (PST) From: Peter Pentchev <roam@ringlet.net> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/36738: [PATCH] newsyslog ownership race condition Message-ID: <200204040920.g349K4067318@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/36738; it has been noted by GNATS. From: Peter Pentchev <roam@ringlet.net> To: Sheldon Hearn <sheldonh@starjuice.net> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200204040920.g349K4067318>