You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Cliff Woolley <cl...@yahoo.com> on 2001/08/31 19:36:58 UTC

Re: cvs commit: apr/user/netware userinfo.c groupinfo.c

On 31 Aug 2001 bnicholes@apache.org wrote:

> bnicholes    01/08/31 09:28:06
>
>   Added:       user/netware userinfo.c groupinfo.c
>   Log:
>   NetWare user and group info functions
>
>   Revision  Changes    Path
>   1.1                  apr/user/netware/userinfo.c
>
>   APR_DECLARE(apr_status_t) apr_get_home_directory(char **dirname,
>                                                    const char *username,
>                                                    apr_pool_t *p)
>   {
>       return APR_SUCCESS;
>   }

Stubs like this in APR typically return APR_ENOTIMPL so that the caller
has some way to know that *dirname (in this example) was not set so it can
avoid a segfault if it wants...

--Cliff

--------------------------------------------------------------
   Cliff Woolley
   cliffwoolley@yahoo.com
   Charlottesville, VA



Re: cvs commit: apr/user/netware userinfo.c groupinfo.c

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
From: "Cliff Woolley" <cl...@yahoo.com>
Sent: Friday, August 31, 2001 12:36 PM


On 31 Aug 2001 bnicholes@apache.org wrote:

> bnicholes    01/08/31 09:28:06
>
>   Added:       user/netware userinfo.c groupinfo.c
>   Log:
>   NetWare user and group info functions
>
>   Revision  Changes    Path
>   1.1                  apr/user/netware/userinfo.c
>
>   APR_DECLARE(apr_status_t) apr_get_home_directory(char **dirname,
>                                                    const char *username,
>                                                    apr_pool_t *p)
>   {
>       return APR_SUCCESS;
>   }

 >Stubs like this in APR typically return APR_ENOTIMPL so that the caller
>has some way to know that *dirname (in this example) was not set so it can
>avoid a segfault if it wants...

---

More than typically.  You've promised that apr_get_home_directory has set
dirname.  If the variable that dirname points at 'happened' to have some valid
pointer (to garbage data) - you might not even segfault.  This is a bug.

As Cliff points out, APR_ENOTIMPL is a safer stub if there is anything the
function was required to return/alter as part of its behavior.