WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [Xen-changelog] Make xenstored reopen its trace file on

To: Anthony Liguori <aliguori@xxxxxxxxxx>
Subject: [Xen-devel] Re: [Xen-changelog] Make xenstored reopen its trace file on SIGHUP. This allows one to rotate the
From: Ewan Mellor <ewan@xxxxxxxxxxxxx>
Date: Mon, 7 Nov 2005 17:23:13 +0000
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Mon, 07 Nov 2005 17:23:35 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <436F8BB6.1090207@xxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <E1EZ6jH-0002pi-4u@xxxxxxxxxxxxxxxxxxxxx> <436F8BB6.1090207@xxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.9i
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.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel