You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2002/02/12 01:07:34 UTC

cvs commit: apr/file_io/win32 open.c

wrowe       02/02/11 16:07:34

  Modified:    file_io/win32 open.c
  Log:
    I don't trust that the OS is even returning an error - if the handle
    is an invalid handle - I'm not certain that's an error.  Certainly
    this code is safer - merits pushing into .32
  
  Revision  Changes    Path
  1.93      +3 -3      apr/file_io/win32/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/open.c,v
  retrieving revision 1.92
  retrieving revision 1.93
  diff -u -r1.92 -r1.93
  --- open.c	29 Jan 2002 05:49:21 -0000	1.92
  +++ open.c	12 Feb 2002 00:07:34 -0000	1.93
  @@ -534,7 +534,7 @@
   
       file_handle = GetStdHandle(STD_ERROR_HANDLE);
       if (file_handle == INVALID_HANDLE_VALUE)
  -        return apr_get_os_error();
  +        return APR_EINVAL;
   
       return apr_os_file_put(thefile, &file_handle, 0, cont);
   }
  @@ -545,7 +545,7 @@
   
       file_handle = GetStdHandle(STD_OUTPUT_HANDLE);
       if (file_handle == INVALID_HANDLE_VALUE)
  -        return apr_get_os_error();
  +        return APR_EINVAL;
   
       return apr_os_file_put(thefile, &file_handle, 0, cont);
   }
  @@ -556,7 +556,7 @@
   
       file_handle = GetStdHandle(STD_INPUT_HANDLE);
       if (file_handle == INVALID_HANDLE_VALUE)
  -        return apr_get_os_error();
  +        return APR_EINVAL;
   
       return apr_os_file_put(thefile, &file_handle, 0, cont);
   }
  
  
  

Re: cvs commit: apr/file_io/win32 open.c

Posted by Branko Čibej <br...@xbc.nu>.
William A. Rowe, Jr. wrote:

>>>wrowe       02/02/11 16:07:34
>>>
>>> Modified:    file_io/win32 open.c
>>> Log:
>>>   I don't trust that the OS is even returning an error - if the handle
>>>   is an invalid handle - I'm not certain that's an error.  Certainly
>>>   this code is safer - merits pushing into .32
>>>
>
>>>      if (file_handle == INVALID_HANDLE_VALUE)
>>> -        return apr_get_os_error();
>>> +        return APR_EINVAL;
>>>
>> From MSDN:
>>
>>    Return Values
>>    If the function succeeds, the return value is a handle to the
>>    specified device.
>>
>>    If the function fails, the return value is the INVALID_HANDLE_VALUE
>>    flag. To get extended error information, call GetLastError.
>>
>
>That would be fine if we were matching to INVALID_HANDLE_VALUE.  We are
>discovering NULL rather than (DWORD)-1.  This patch is not yet complete, at
>that, since we aren't testing for the NULL case.  I'll be fixing in a moment.
>
If you get NULL back in this case, that means the standard handle isn't 
defined. It does not mean that GetStdHandle failed. Those two situations 
are different.

-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/




Re: cvs commit: apr/file_io/win32 open.c

Posted by "William A. Rowe, Jr." <wr...@covalent.net>.
> >wrowe       02/02/11 16:07:34
> >
> >  Modified:    file_io/win32 open.c
> >  Log:
> >    I don't trust that the OS is even returning an error - if the handle
> >    is an invalid handle - I'm not certain that's an error.  Certainly
> >    this code is safer - merits pushing into .32

> >       if (file_handle == INVALID_HANDLE_VALUE)
> >  -        return apr_get_os_error();
> >  +        return APR_EINVAL;
> 
>  From MSDN:
> 
>     Return Values
>     If the function succeeds, the return value is a handle to the
>     specified device.
> 
>     If the function fails, the return value is the INVALID_HANDLE_VALUE
>     flag. To get extended error information, call GetLastError.

That would be fine if we were matching to INVALID_HANDLE_VALUE.  We are
discovering NULL rather than (DWORD)-1.  This patch is not yet complete, at
that, since we aren't testing for the NULL case.  I'll be fixing in a moment.

Bill


Re: cvs commit: apr/file_io/win32 open.c

Posted by Branko Čibej <br...@xbc.nu>.
wrowe@apache.org wrote:

>wrowe       02/02/11 16:07:34
>
>  Modified:    file_io/win32 open.c
>  Log:
>    I don't trust that the OS is even returning an error - if the handle
>    is an invalid handle - I'm not certain that's an error.  Certainly
>    this code is safer - merits pushing into .32
>  
>  Revision  Changes    Path
>  1.93      +3 -3      apr/file_io/win32/open.c
>  
>  Index: open.c
>  ===================================================================
>  RCS file: /home/cvs/apr/file_io/win32/open.c,v
>  retrieving revision 1.92
>  retrieving revision 1.93
>  diff -u -r1.92 -r1.93
>  --- open.c	29 Jan 2002 05:49:21 -0000	1.92
>  +++ open.c	12 Feb 2002 00:07:34 -0000	1.93
>  @@ -534,7 +534,7 @@
>   
>       file_handle = GetStdHandle(STD_ERROR_HANDLE);
>       if (file_handle == INVALID_HANDLE_VALUE)
>  -        return apr_get_os_error();
>  +        return APR_EINVAL;
>
...

 From MSDN:

    Return Values
    If the function succeeds, the return value is a handle to the
    specified device.

    If the function fails, the return value is the INVALID_HANDLE_VALUE
    flag. To get extended error information, call GetLastError.




-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/




Status of JRE_1 roll was Re: cvs commit: apr/file_io/win32 open.c

Posted by Justin Erenkrantz <je...@ebuilt.com>.
On Tue, Feb 12, 2002 at 12:07:34AM -0000, wrowe@apache.org wrote:
> wrowe       02/02/11 16:07:34
> 
>   Modified:    file_io/win32 open.c
>   Log:
>     I don't trust that the OS is even returning an error - if the handle
>     is an invalid handle - I'm not certain that's an error.  Certainly
>     this code is safer - merits pushing into .32
>   
>   Revision  Changes    Path
>   1.93      +3 -3      apr/file_io/win32/open.c

JRE_1 tag bumped to 1.93.  

I won't have time to roll until tomorrow night and that's iffy due to
midterms.  So, feel free to make changes and either note in the commit
log or better yet send a message to dev@ indicating that you think it
should be bumped to be included in my tree.  And, certainly, for
Win32 files, I'll defer to you on what is needed.  (But, please
don't bump yourself - otherwise, I'll lose track.)  -- justin