summaryrefslogtreecommitdiffstats
path: root/toolbox
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-01-17 03:50:05 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-01-17 03:50:05 +0000
commitf8eac2ffc62cb83cc3160f4e0425455e6be01212 (patch)
tree208014329e346054a8a9cb38d76d1ce01798785d /toolbox
parentbb604524fb6d72e7ab9d32c705156561e8c7d251 (diff)
parentce34551ce6559fe97043a26e3df65396c91bdffc (diff)
downloadsystem_core-f8eac2ffc62cb83cc3160f4e0425455e6be01212.zip
system_core-f8eac2ffc62cb83cc3160f4e0425455e6be01212.tar.gz
system_core-f8eac2ffc62cb83cc3160f4e0425455e6be01212.tar.bz2
am ce34551c: Merge "Lose id to toybox."
* commit 'ce34551ce6559fe97043a26e3df65396c91bdffc': Lose id to toybox.
Diffstat (limited to 'toolbox')
-rw-r--r--toolbox/Android.mk1
-rw-r--r--toolbox/id.c57
2 files changed, 0 insertions, 58 deletions
diff --git a/toolbox/Android.mk b/toolbox/Android.mk
index f6f57cc..a0dcac1 100644
--- a/toolbox/Android.mk
+++ b/toolbox/Android.mk
@@ -57,7 +57,6 @@ OUR_TOOLS := \
getevent \
getprop \
getsebool \
- id \
iftop \
ioctl \
ionice \
diff --git a/toolbox/id.c b/toolbox/id.c
deleted file mode 100644
index 8ec79c1..0000000
--- a/toolbox/id.c
+++ /dev/null
@@ -1,57 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <pwd.h>
-#include <grp.h>
-#include <selinux/selinux.h>
-
-static void print_uid(uid_t uid)
-{
- struct passwd *pw = getpwuid(uid);
-
- if (pw) {
- printf("%d(%s)", uid, pw->pw_name);
- } else {
- printf("%d",uid);
- }
-}
-
-static void print_gid(gid_t gid)
-{
- struct group *gr = getgrgid(gid);
- if (gr) {
- printf("%d(%s)", gid, gr->gr_name);
- } else {
- printf("%d",gid);
- }
-}
-
-int id_main(int argc, char **argv)
-{
- gid_t list[64];
- int n, max;
- char *secctx;
-
- max = getgroups(64, list);
- if (max < 0) max = 0;
-
- printf("uid=");
- print_uid(getuid());
- printf(" gid=");
- print_gid(getgid());
- if (max) {
- printf(" groups=");
- print_gid(list[0]);
- for(n = 1; n < max; n++) {
- printf(",");
- print_gid(list[n]);
- }
- }
- if (getcon(&secctx) == 0) {
- printf(" context=%s", secctx);
- free(secctx);
- }
- printf("\n");
- return 0;
-}