From ernst@zaphod.euronet.nl  Mon Jan 20 03:15:02 2003
Return-Path: <ernst@zaphod.euronet.nl>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id D7F5A37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 20 Jan 2003 03:15:02 -0800 (PST)
Received: from zaphod.euronet.nl (zaphod.euronet.nl [194.134.168.213])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 883E543F1E
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 20 Jan 2003 03:15:01 -0800 (PST)
	(envelope-from ernst@zaphod.euronet.nl)
Received: from zaphod.euronet.nl (localhost [127.0.0.1])
	by zaphod.euronet.nl (8.12.6/8.12.6) with ESMTP id h0KACo9c061696;
	Mon, 20 Jan 2003 11:12:50 +0100 (CET)
	(envelope-from ernst@zaphod.euronet.nl)
Received: (from ernst@localhost)
	by zaphod.euronet.nl (8.12.6/8.12.6/Submit) id h0KACoRs061695;
	Mon, 20 Jan 2003 11:12:50 +0100 (CET)
Message-Id: <200301201112.50255.znerd@FreeBSD.org>
Date: Mon, 20 Jan 2003 11:12:50 +0100
From: Ernst de Haan <znerd@freebsd.org>
To: Kees Jan Koster <kjkoster@kjkoster.org>,
	FreeBSD-gnats-submit@freebsd.org
In-Reply-To: <200301201008.h0KA8hqQ022321@www.kjkoster.org>
Subject: Re: daemonctl scribbles over log file when single file is specified
References: <200301201008.h0KA8hqQ022321@www.kjkoster.org>

>Number:         47247
>Category:       junk
>Synopsis:       Re: daemonctl scribbles over log file when single file is specified
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    ceri
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 20 03:20:01 PST 2003
>Closed-Date:    Mon Jan 20 07:18:23 PST 2003
>Last-Modified:  Mon Jan 20 07:18:23 PST 2003
>Originator:     
>Release:        
>Organization:
>Environment:
>Description:
 Kees Jan,
 
 Thanks for the patch! Could you test it (or ask some freebsd-java buds)?
 
 Ernst
 
 
 On Monday 20 January 2003 11:08, Kees Jan Koster wrote:
 > >Submitter-Id:	current-users
 > >Originator:	Kees Jan Koster
 > >Organization:	n.a.
 > >Confidential:	no
 > >Synopsis:	daemonctl scribbles over log file when single file is
 > > specified Severity:	serious
 > >Priority:	medium
 > >Category:	ports
 > >Class:		sw-bug
 > >Release:	FreeBSD 4.7-STABLE i386
 > >Environment:
 >
 > System: FreeBSD www.kjkoster.org 4.7-STABLE FreeBSD 4.7-STABLE #23: Fri
 > Oct 11 00:03:25 CEST 2002
 > kjkoster@LikeEver.kjkoster.org:/usr/obj/usr/src/sys/WWW i386
 >
 > Daemonctl script for Orion and Tomcat.
 >
 > >Description:
 >
 > Specifying a single log file for Orion (or Tomcat) in the port's Makefile
 > will cause the first few lines in that log file to be garbled. This is
 > caused by the way daemonctl opens the log file.
 >
 > >How-To-Repeat:
 >
 > Specify the same file for the symbols STDOUT_LOG and STDERR_LOG in the
 > Makefile and reinstall the port. Notice how stderr and stdout overwrite
 > eachother in the fist few lines of that file.
 >
 > >Fix:
 >
 > Here's an untested fix.
 >
 > --- daemonctl.c.orig    Mon Jan 20 10:54:56 2003
 > +++ daemonctl.c Mon Jan 20 10:55:18 2003
 > @@ -385,24 +385,22 @@
 >         }
 >
 >         /* Open the stdout log file */
 > -       stdoutLogFile = open("%%STDOUT_LOG%%", O_WRONLY);
 > +       stdoutLogFile = open("%%STDOUT_LOG%%", O_APPEND);
 >         if (stdoutLogFile < 0) {
 >                 printf(" [ FAILED ]\n");
 >                 fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to open
 > %%STDOUT_LOG%% for writing: "); perror(NULL);
 >                 exit(ERR_STDOUT_LOGFILE_OPEN);
 >         }
 > -       lseek(stdoutLogFile, (off_t) 0, SEEK_END);
 >
 >         /* Open the stderr log file */
 > -       stderrLogFile = open("%%STDERR_LOG%%", O_WRONLY);
 > +       stderrLogFile = open("%%STDERR_LOG%%", O_APPEND);
 >         if (stderrLogFile < 0) {
 >                 printf(" [ FAILED ]\n");
 >                 fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to open
 > %%STDERR_LOG%% for writing: "); perror(NULL);
 >                 exit(ERR_STDERR_LOGFILE_OPEN);
 >         }
 > -       lseek(stderrLogFile, (off_t) 0, SEEK_END);
 >
 >         /* Split this process in two */
 >         pid = fork();
 
 -- 
 Ernst de Haan
 Development Team Leader
 Wanadoo Nederland B.V.
 
     The Lord has truly risen!
     Merry Christmas and a blessed New Year!
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: ceri 
State-Changed-When: Mon Jan 20 07:17:35 PST 2003 
State-Changed-Why:  
Misfiled follow-up to ports/47245 [content migrated]. 


Responsible-Changed-From-To: gnats-admin->ceri 
Responsible-Changed-By: ceri 
Responsible-Changed-When: Mon Jan 20 07:17:35 PST 2003 
Responsible-Changed-Why:  
Take from gnats-admin. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=47247 
>Unformatted:
