warnings in libbb.h

Tito farmatito at tiscali.it
Mon Sep 12 06:32:12 UTC 2005


On Monday 12 September 2005 03:37, Rob Landley wrote:
> On Sunday 11 September 2005 16:15, Bernhard Fischer wrote:

> bb_xgetgrnam() seems more likely for the first one, since the x generally 
> seems to mean "die if this isn't found"...
> 
> Tito was the last guy to play with these. :)
Hi,
You can do:
my_getpwnam() -> bb_xgetpwnam()
my_getgrnam()  -> bb_xgetgrnam()

but not for:
my_getgrgid()
my_getpwuid()
my_getug()

as this functions don't always die on error:

char * my_getpwuid(char *name, long uid, int bufsize)

   if bufsize is > 0 char *name can not be set to NULL.
                     On success username is written on the static allocated buffer name 
                     (and a pointer to it is returned).
                     On failure uid as string is written to the static allocated buffer name
                     and NULL is returned.
   if bufsize is = 0 char *name can be set to NULL.
                     On success username is returned. 
                     On failure NULL is returned.
   if bufsize is < 0 char *name can be set to NULL
                     On success username is returned.
                     On failure an error message is printed and the program exits.   
  
my_getug is an internal function for my_getpwuid and my_getgrgid.

For these we need a different naming.

Ciao,
Tito





More information about the busybox mailing list