From e6aac70496c05aed73c7c5ed881172ab5e23209b Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Mon, 4 Nov 2019 21:24:42 -0800 Subject: id: fix Android issues. glibc doesn't set errno when getpw* fails, so the perror_exit() looked fine. bionic sets ENOENT and the trailing "No such file or directory" looks silly, so switch to error_exit(). Additionally, the default format tests fail on Android because of SELinux (but for a different reason than usual!). There's no id --no-context flag, so use sed to just throw away any SELinux context. --- toys/posix/id.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toys') diff --git a/toys/posix/id.c b/toys/posix/id.c index ac29990b..6f71891b 100644 --- a/toys/posix/id.c +++ b/toys/posix/id.c @@ -98,7 +98,7 @@ static void do_id(char *username) uid = atolx_range(username, 0, INT_MAX); if ((pw = getpwuid(uid))) username = pw->pw_name; } - if (!pw) perror_exit("no such user '%s'", username); + if (!pw) error_exit("no such user '%s'", username); uid = euid = pw->pw_uid; gid = egid = pw->pw_gid; if (TT.is_groups) printf("%s : ", pw->pw_name); -- cgit v1.2.3