abuild-sudo: enforce correct value for USER

This commit is contained in:
Kaarle Ritvanen 2017-04-21 11:50:32 +03:00 committed by Timo Teräs
parent 440bb02fd7
commit 5a4e6f3889
1 changed files with 2 additions and 1 deletions

View File

@ -74,11 +74,12 @@ int main(int argc, const char *argv[])
if (grent == NULL)
errx(1, "%s: Group not found", ABUILD_GROUP);
char *name = getlogin();
if (!is_in_group(grent->gr_gid)) {
char *name = getlogin();
errx(1, "User %s is not a member of group %s\n",
name ? name : "(unknown)", ABUILD_GROUP);
}
setenv("USER", name, 1);
cmd = strrchr(argv[0], '/');
if (cmd)