[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Re: [Xen-changelog] Make xenstored reopen its trace file on SIGHUP. This allows one to rotate the



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.