httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <>
Subject fprintf(stderr in Apache and APR.
Date Mon, 15 Nov 1999 21:19:02 GMT

There is an item in the STATUS file about having "fprintf(stderr" in the
code.  On Windows, this is no longer a good thing, because we don't ever
point stderr to the error log.  This is EASY to fix in Apache, just
replace all the fprintf(stderr with ap_log_[r]error.  And make those
ap_log_[r]error use stderr (or equivalent) if the server_rec's aren't
setup yet.  I think this last part has been done already I'll check

Things get a bit harder in APR.  We still can't use fprintf(stderr, but we
also can't use ap_log_[r]error.  To make matters worse, these fprintf's
are the only way we can determine why we failed.  For example, very often
if there is a problem, we will print out the message, and then either
return or exit with a common value (usually 1 or 0).  If we remove the
printf, there is no way to tell which if-clause caused us to fail.  I see
a few possibilities to fix this.  This is only an issue for those
functions we moved from Apache into APR.

1)  Re-write all the apr functions to follow the return a defined status

2)  Return a different error condition for each return statement.  (i.e.
-1, -2, -3, etc)

3)  Leave it alone and use fprintf(stderr, excepting that this doesn't
work properly on Windows.

I like option 1 the best, but I am looking for other ideas and/or opions
on the right way to attack this.


Ryan Bloom
4205 S Miami Blvd	
RTP, NC 27709		It's a beautiful sight to see good dancers 
			doing simple steps.  It's a painful sight to
			see beginners doing complicated patterns.	

View raw message