Path: utzoo!utgpu!attcan!uunet!lll-winken!lll-lcc!ames!xanth!cs.odu.edu!tadguy From: tadguy@cs.odu.edu (Tad Guy) Newsgroups: comp.unix.wizards Subject: Re: syslog(), openlog(), bug in syslog.c patch Message-ID: <6865@xanth.cs.odu.edu> Date: 16 Dec 88 03:40:09 GMT References: <17826@adm.BRL.MIL> Sender: news@xanth.cs.odu.edu Reply-To: tadguy@cs.odu.edu (Tad Guy) Organization: Old Dominion University, Norfolk, VA Lines: 28 In-reply-to: becker@trantor.harris-atd.com (Don Becker) In article <17826@adm.BRL.MIL>, becker@trantor (Don Becker) writes: >I installed a fix similar to the one suggested by Tad Guy >. A quick look at his change suggests that he >doesn't deal with the case where a connect() is not done -- he always >has syslog() do a send() rather than a sendto() to the socket. I considered this, and unless I am reading the source wrong, connect() is guaranteed to have been called before the send(). Even if you call syslog() without first calling openlog() (or after calling openlog() but without LOG_NDELAY set), syslog() calls openlog() for you with LOG_NDELAY set, thus guarantying that the socket is created and (with my patch) connected before any calls to send() occur. This is with the 4.3BSD syslog.c (version 5.9 dated 5/7/86). Your version may be different. >Making a connection is the Right Thing, and should be default. It >should be more efficient than doing namei() on "/dev/log" each time >inside of sendto, but I suspect that it isn't. It is. But, as Louis Mamakos pointed out, doing the connect() is a bad idea for long running processes, because they run the risk of having the inode info for an obsolete "/dev/log" should syslogd be restarted. ...tad -- Tad Guy Old Dominion University, Norfolk, VA