diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2016-04-14 11:48:30 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2016-04-14 11:52:59 +0000 |
commit | bd5636c916fb13be2b3665059adedaad385c88e1 (patch) | |
tree | 12a2fe57dfc382eca3c94aab74278c287433c358 | |
parent | 5487632f300d7109c47b1021d57f02e269ed17e8 (diff) | |
download | abuild-bd5636c916fb13be2b3665059adedaad385c88e1.tar.bz2 abuild-bd5636c916fb13be2b3665059adedaad385c88e1.tar.xz |
abuild-sudo: error check getlogin()
-rw-r--r-- | abuild-sudo.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/abuild-sudo.c b/abuild-sudo.c index f0c074e..7b6235a 100644 --- a/abuild-sudo.c +++ b/abuild-sudo.c @@ -75,8 +75,9 @@ int main(int argc, const char *argv[]) errx(1, "%s: Group not found", ABUILD_GROUP); if (!is_in_group(grent->gr_gid)) { + char *name = getlogin(); errx(1, "User %s is not a member of group %s\n", - getlogin(), ABUILD_GROUP); + name ? name : "(unknown)", ABUILD_GROUP); } cmd = strrchr(argv[0], '-'); |