Re: [PATCH v4 15/15] daemon: opt-out on features that require posix
- From
Erik Faye-Lund <kusmabite@gmail.com>
- Date
- Oct 21, 2010, 22:04 UTC
- Message-ID
- <AANLkTinsKoYupt=yO9eVkpufzNDnke865UfMLKWSS6J1@mail.gmail.com>
- In-Reply-To
- <AANLkTi=ydzrvy6_PbFLpA_qcHzF-8s3xbu3XvU5GnQ_k@mail.gmail.com>
On Fri, Oct 22, 2010 at 12:00 AM, Erik Faye-Lund <kusmabite@gmail.com> wrote:
Show 23 quoted lines
> if (user_name) {
> - pass = getpwnam(user_name);
> - if (!pass)
> + struct credentials c;
> + cred = &c;
> +
> + c->pass = getpwnam(user_name);
> + if (!c->pass)
> die("user not found - %s", user_name);
>
> if (!group_name)
> - gid = pass->pw_gid;
> + c->gid = pass->pw_gid;
> else {
> - group = getgrnam(group_name);
> + struct group *group = getgrnam(group_name);
> if (!group)
> die("group not found - %s", group_name);
>
> - gid = group->gr_gid;
> + c->gid = group->gr_gid;
> }
> }Sorry for the noise, but this is clearly incorrect and won't compile. I guess replacing "c->" with "c." should do the trick :)
If I got this way, I'll obviously make sure it compiles! ;)