bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gdomap user fix


From: Chris B. Vetter
Subject: Re: gdomap user fix
Date: Fri, 5 Sep 2003 11:41:45 -0700

On Fri, 05 Sep 2003 19:56:47 +0200
David Ayers <d.ayers@inode.at> wrote:
> >+    else // Failed, let's try as a number
> >+      {
> >+        long        id;
> >+        char        *p;
> >+        id = strtol(name, &p, 10);
> This seems wrong to me.  Is there anyway that id can be non-zero given
> the string "nobody"?  Instead should we try the "default" UID for
> nobody which seems to be 65534 (I'm not sure if some standard
> specifies this. and maybe all we need to use it the uid/gid values we
> set up previously.)

On a system that does have 'nobody' the else {} clause isn't executed
anyway, so it will only be needed for systems that know nothing about
it. Well, that's kinda obvious ;-)

We could probably skip it completely and assume the default values that
are assigned earlier, when/where we declared 'uid' and 'gid'.
Saves the additional check.

> >+        if( *name && !*p && (pwd = getpwuid(id)) )
> Why check *name?  All functions previously using it seem to be
> declared const char * so the contents must be unchanged.... But if my
> earlier assertion holds p and potentially name should be obsolete
> anyway.

Yes, you're right. 'name' is a const, so the check is not really needed.
My bad.

-- 
Chris




reply via email to

[Prev in Thread] Current Thread [Next in Thread]