This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 1.5.5-1: fprintf(stdout, ...) writes to serial port when used by apcupsd

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
> 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:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]