Date: Mon, 20 Jan 2003 11:08:43 +0100 (CET) From: Kees Jan Koster <kjkoster@kjkoster.org> To: FreeBSD-gnats-submit@FreeBSD.org Cc: znerd@FreeBSD.org Subject: ports/47245: daemonctl scribbles over log file when single file is specified Message-ID: <200301201008.h0KA8hqQ022321@www.kjkoster.org>
next in thread | raw e-mail | index | archive | help
>Number: 47245 >Category: ports >Synopsis: daemonctl scribbles over log file when single file is specified >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jan 20 02:10:03 PST 2003 >Closed-Date: >Last-Modified: >Originator: Kees Jan Koster >Release: FreeBSD 4.7-STABLE i386 >Organization: n.a. >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(); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200301201008.h0KA8hqQ022321>