Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Mon, 27 Oct 2003 22:13:12 -0500 From: Christopher Faylor To: cygwin AT cygwin DOT com Cc: usenet2003c AT alexanderweb DOT de Subject: Re: 1.5.5-1: fprintf(stdout, ...) writes to serial port when used by apcupsd Message-ID: <20031028031312.GA9238@redhat.com> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com, usenet2003c AT alexanderweb DOT de References: <12107mcqwov6m$.dlg AT alexanderweb DOT de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <12107mcqwov6m$.dlg@alexanderweb.de> User-Agent: Mutt/1.4.1i On Mon, Oct 27, 2003 at 05:46:19PM +0100, Alexander Schremmer wrote: >I am experiencing a bug or race condition while using the newest >release of apcupsd (3.10.6 - 2003-10-10; GPL and available under >http://sourceforge.net/projects/apcupsd) on the newest releast of >Cygwin (1.5.5-1). This bug does not occur using cygwin1.dll v1.3.20. > >I searched for a similar bug report in the mailing list archives but >didn't find anything. > >apcupsd communicates to UPS (uninteruptable power supplies) over the >serial port and therefore has opened this port. apcupsd supports >printing debug output which is enabled by the parameter "-d 400" >whereas 400 is the debug level. When this debugging output is enabled >you can expect a regular call to fprintf(stdout, ...) with the debug >information. But if I start "apcupsd -d 400" outside of a >cygwin-shell/program, i.e. using Start | Run, it will have no standard >stream (stdout) to write the debug data. Maybe because of that, >apcupsd starts sending the fprintf data to the serial port though it >should go to a stdout. This caused my UPS to restart the PC directly >(because the debug line seemed to contain some hot chars *g*). I >checked that the call gets forwarded to the serial port with portmon. > >I think that fprintf should rather fail but not use a serial port >instead of stdout. Can somebody fix this? I don't know Posix very >well, but stdout should point to an invalid descriptor and not to the >serial port in cases where the stream is not opened. This is not a cygwin problem. It is a problem with a program that assumes that it has a valid stdout. It is perfectly possible that a program can be started with no stdout, stdin, or stderr. You need to fix apcupsd. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/