From: Ewan Mellor Subject: Re: [Xen-changelog] Make xenstored reopen its trace file on SIGHUP. This allows one to rotate the Date: Mon, 7 Nov 2005 17:23:13 +0000 Message-ID: <20051107172313.GL12773@leeni.uk.xensource.com> References: <436F8BB6.1090207@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <436F8BB6.1090207@us.ibm.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Anthony Liguori Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On Mon, Nov 07, 2005 at 11:15:34AM -0600, Anthony Liguori wrote: > Xen patchbot -unstable wrote: > > > > >+void reopen_log() > >+{ > >+ if (!tracefile) > >+ return; > >+ > >+ if (tracefd > 0) > >+ close(tracefd); > >+ tracefd = open(tracefile, O_WRONLY|O_CREAT|O_APPEND, 0600); > >+ if (tracefd < 0) { > >+ perror("Could not open tracefile"); > >+ return; > >+ } > >+ write(tracefd, "\n***\n", strlen("\n***\n")); > >+} > >+ > > > > > perror and strlen are not safe to call from a signal handler. OK, I'll believe you about perror - thanks for spotting that. Why, though, should strlen not be safe? Even if strlen(constant) doesn't turn into a constant integer at compile-time, which I rather hope that it would, why in any case would strlen be a problem? Ewan.