Re: cvs commit: apache-2.0/src/lib/apr/file_io/unix open.c

1999-09-13 Thread Ryan Bloom

   -if ((*new)-filedes  0  (*new)-filehand == NULL) {
   +if ((*new)-filedes  0 || (*new)-filehand == NULL) {
   (*new)-filedes = -1;
   (*new)-eof_hit = 1;
return errno;

This is wrong.  This says that we NEVER open the file correctly.  This is
because we only ever set one of the two options, either the filedes or the
filehand, NEVER both.  We are checking for the error condition, not the
successful case.  Either the filedes or the filehand WILL be not set after
each open.  I have serious doubts that the code even works anymore.  If
it does, it is only because we aren't checking return code properly.

Ryan



___
Ryan Bloom  [EMAIL PROTECTED]
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.   



Re: cvs commit: apache-2.0/src/lib/apr/file_io/unix open.c

1999-09-13 Thread Ben Laurie
Ryan Bloom wrote:
 
 
-if ((*new)-filedes  0  (*new)-filehand == NULL) {
+if ((*new)-filedes  0 || (*new)-filehand == NULL) {
(*new)-filedes = -1;
(*new)-eof_hit = 1;
 return errno;
 
 This is wrong.  This says that we NEVER open the file correctly.  This is
 because we only ever set one of the two options, either the filedes or the
 filehand, NEVER both.

Yeah but filedes == 0 when you use filehand (which is possibly a bug).

  We are checking for the error condition, not the
 successful case.  Either the filedes or the filehand WILL be not set after
 each open.  I have serious doubts that the code even works anymore.  If
 it does, it is only because we aren't checking return code properly.

OK, well it didn't work before, and it now does _when_ it is using
filehand. I agree this it is still broken, though, but less so than
before.

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html

My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there.
 - Indira Gandhi


Re: cvs commit: apache-2.0/src/lib/apr/file_io/unix open.c

1999-09-13 Thread Ryan Bloom
 Yeah but filedes == 0 when you use filehand (which is possibly a bug).

OK.  This is the bug.  Filedes should be -1.  I don't know how I missed
that in my testing, because we are using filedes all over the place.  I'll
fix this ASAP.

 OK, well it didn't work before, and it now does _when_ it is using
 filehand. I agree this it is still broken, though, but less so than
 before.

Agreed.  The best way to fix it, IMHO, is to init filedes to -1 and make
the original check.

Ryan

___
Ryan Bloom  [EMAIL PROTECTED]
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.