Erik Andersen | 94f5e0b | 2000-05-01 19:10:52 +0000 | [diff] [blame] | 1 | /* vi: set sw=4 ts=4: */ |
| 2 | /* |
| 3 | * Mini id implementation for busybox |
| 4 | * |
Erik Andersen | 94f5e0b | 2000-05-01 19:10:52 +0000 | [diff] [blame] | 5 | * Copyright (C) 2000 by Randolph Chung <tausq@debian.org> |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 6 | * Copyright (C) 2008 by Tito Ragusa <farmatito@tiscali.it> |
Erik Andersen | 94f5e0b | 2000-05-01 19:10:52 +0000 | [diff] [blame] | 7 | * |
Denys Vlasenko | 0ef64bd | 2010-08-16 20:14:46 +0200 | [diff] [blame] | 8 | * Licensed under GPLv2 or later, see file LICENSE in this source tree. |
Erik Andersen | 94f5e0b | 2000-05-01 19:10:52 +0000 | [diff] [blame] | 9 | */ |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 10 | /* Hacked by Tito Ragusa (C) 2004 to handle usernames of whatever |
| 11 | * length and to be more similar to GNU id. |
Denis Vlasenko | 49622d7 | 2007-03-10 16:58:49 +0000 | [diff] [blame] | 12 | * -Z option support: by Yuichi Nakamura <ynakam@hitachisoft.jp> |
Bernhard Reutner-Fischer | 0ee1cb0 | 2008-09-12 09:58:11 +0000 | [diff] [blame] | 13 | * Added -G option Tito Ragusa (C) 2008 for SUSv3. |
Eric Andersen | 7eb79ff | 2004-09-02 22:21:41 +0000 | [diff] [blame] | 14 | */ |
Tito Ragusa | 33092f1 | 2011-06-21 17:11:40 +0200 | [diff] [blame] | 15 | //config:config ID |
Denys Vlasenko | b097a84 | 2018-12-28 03:20:17 +0100 | [diff] [blame] | 16 | //config: bool "id (7 kb)" |
Tito Ragusa | 33092f1 | 2011-06-21 17:11:40 +0200 | [diff] [blame] | 17 | //config: default y |
| 18 | //config: help |
Denys Vlasenko | 72089cf | 2017-07-21 09:50:55 +0200 | [diff] [blame] | 19 | //config: id displays the current user and group ID names. |
Denys Vlasenko | af3f420 | 2016-11-23 14:46:56 +0100 | [diff] [blame] | 20 | //config: |
Tito Ragusa | 33092f1 | 2011-06-21 17:11:40 +0200 | [diff] [blame] | 21 | //config:config GROUPS |
Denys Vlasenko | b097a84 | 2018-12-28 03:20:17 +0100 | [diff] [blame] | 22 | //config: bool "groups (6.7 kb)" |
Tito Ragusa | 33092f1 | 2011-06-21 17:11:40 +0200 | [diff] [blame] | 23 | //config: default y |
| 24 | //config: help |
Denys Vlasenko | 72089cf | 2017-07-21 09:50:55 +0200 | [diff] [blame] | 25 | //config: Print the group names associated with current user id. |
Tito Ragusa | 33092f1 | 2011-06-21 17:11:40 +0200 | [diff] [blame] | 26 | |
Denys Vlasenko | af3f420 | 2016-11-23 14:46:56 +0100 | [diff] [blame] | 27 | //applet:IF_GROUPS(APPLET_NOEXEC(groups, id, BB_DIR_USR_BIN, BB_SUID_DROP, groups)) |
| 28 | //applet:IF_ID( APPLET_NOEXEC(id, id, BB_DIR_USR_BIN, BB_SUID_DROP, id )) |
| 29 | |
Tito Ragusa | 33092f1 | 2011-06-21 17:11:40 +0200 | [diff] [blame] | 30 | //kbuild:lib-$(CONFIG_GROUPS) += id.o |
| 31 | //kbuild:lib-$(CONFIG_ID) += id.o |
| 32 | |
Denys Vlasenko | af3f420 | 2016-11-23 14:46:56 +0100 | [diff] [blame] | 33 | /* BB_AUDIT SUSv3 compliant. */ |
Tito Ragusa | 33092f1 | 2011-06-21 17:11:40 +0200 | [diff] [blame] | 34 | |
Pere Orga | 3442538 | 2011-03-31 14:43:25 +0200 | [diff] [blame] | 35 | //usage:#define id_trivial_usage |
Denys Vlasenko | 11f1a25 | 2020-12-13 19:04:19 +0100 | [diff] [blame] | 36 | //usage: "[-ugGnr"IF_SELINUX("Z")"] [USER]" |
Pere Orga | 3442538 | 2011-03-31 14:43:25 +0200 | [diff] [blame] | 37 | //usage:#define id_full_usage "\n\n" |
| 38 | //usage: "Print information about USER or the current user\n" |
Pere Orga | 3442538 | 2011-03-31 14:43:25 +0200 | [diff] [blame] | 39 | //usage: IF_SELINUX( |
| 40 | //usage: "\n -Z Security context" |
| 41 | //usage: ) |
| 42 | //usage: "\n -u User ID" |
| 43 | //usage: "\n -g Group ID" |
| 44 | //usage: "\n -G Supplementary group IDs" |
| 45 | //usage: "\n -n Print names instead of numbers" |
| 46 | //usage: "\n -r Print real ID instead of effective ID" |
| 47 | //usage: |
| 48 | //usage:#define id_example_usage |
| 49 | //usage: "$ id\n" |
| 50 | //usage: "uid=1000(andersen) gid=1000(andersen)\n" |
| 51 | |
Tito Ragusa | 33092f1 | 2011-06-21 17:11:40 +0200 | [diff] [blame] | 52 | //usage:#define groups_trivial_usage |
| 53 | //usage: "[USER]" |
| 54 | //usage:#define groups_full_usage "\n\n" |
Denys Vlasenko | e2b9215 | 2021-06-14 20:47:20 +0200 | [diff] [blame] | 55 | //usage: "Print the groups USER is in" |
Tito Ragusa | 33092f1 | 2011-06-21 17:11:40 +0200 | [diff] [blame] | 56 | //usage: |
| 57 | //usage:#define groups_example_usage |
| 58 | //usage: "$ groups\n" |
| 59 | //usage: "andersen lp dialout cdrom floppy\n" |
| 60 | |
Denis Vlasenko | b6adbf1 | 2007-05-26 19:00:18 +0000 | [diff] [blame] | 61 | #include "libbb.h" |
Eric Andersen | 7eb79ff | 2004-09-02 22:21:41 +0000 | [diff] [blame] | 62 | |
Dan Fandrich | 2d1a78b | 2010-09-30 14:31:12 -0700 | [diff] [blame] | 63 | /* This is a NOEXEC applet. Be very careful! */ |
| 64 | |
Denis Vlasenko | de7a52f | 2008-11-17 00:12:17 +0000 | [diff] [blame] | 65 | #if !ENABLE_USE_BB_PWD_GRP |
Mike Frysinger | 445e754 | 2013-03-12 11:13:22 -0400 | [diff] [blame] | 66 | #if defined(__UCLIBC__) && UCLIBC_VERSION < KERNEL_VERSION(0, 9, 30) |
Denis Vlasenko | 5ff1265 | 2008-11-16 15:03:11 +0000 | [diff] [blame] | 67 | #error "Sorry, you need at least uClibc version 0.9.30 for id applet to build" |
| 68 | #endif |
| 69 | #endif |
| 70 | |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 71 | enum { |
| 72 | PRINT_REAL = (1 << 0), |
| 73 | NAME_NOT_NUMBER = (1 << 1), |
| 74 | JUST_USER = (1 << 2), |
| 75 | JUST_GROUP = (1 << 3), |
| 76 | JUST_ALL_GROUPS = (1 << 4), |
Denis Vlasenko | 49622d7 | 2007-03-10 16:58:49 +0000 | [diff] [blame] | 77 | #if ENABLE_SELINUX |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 78 | JUST_CONTEXT = (1 << 5), |
Denis Vlasenko | 49622d7 | 2007-03-10 16:58:49 +0000 | [diff] [blame] | 79 | #endif |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 80 | }; |
Eric Andersen | 7eb79ff | 2004-09-02 22:21:41 +0000 | [diff] [blame] | 81 | |
Denis Vlasenko | 0c68a87 | 2008-12-02 22:56:59 +0000 | [diff] [blame] | 82 | static int print_common(unsigned id, const char *name, const char *prefix) |
"Vladimir N. Oleynik" | 064f04e | 2005-10-11 14:38:01 +0000 | [diff] [blame] | 83 | { |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 84 | if (prefix) { |
| 85 | printf("%s", prefix); |
Glenn L McGrath | f15dfc5 | 2004-09-15 03:04:08 +0000 | [diff] [blame] | 86 | } |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 87 | if (!(option_mask32 & NAME_NOT_NUMBER) || !name) { |
| 88 | printf("%u", id); |
| 89 | } |
| 90 | if (!option_mask32 || (option_mask32 & NAME_NOT_NUMBER)) { |
| 91 | if (name) { |
| 92 | printf(option_mask32 ? "%s" : "(%s)", name); |
| 93 | } else { |
| 94 | /* Don't set error status flag in default mode */ |
| 95 | if (option_mask32) { |
| 96 | if (ENABLE_DESKTOP) |
| 97 | bb_error_msg("unknown ID %u", id); |
| 98 | return EXIT_FAILURE; |
| 99 | } |
| 100 | } |
| 101 | } |
| 102 | return EXIT_SUCCESS; |
Eric Andersen | 7eb79ff | 2004-09-02 22:21:41 +0000 | [diff] [blame] | 103 | } |
Manuel Novoa III | cad5364 | 2003-03-19 09:13:01 +0000 | [diff] [blame] | 104 | |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 105 | static int print_group(gid_t id, const char *prefix) |
| 106 | { |
Denis Vlasenko | 0c68a87 | 2008-12-02 22:56:59 +0000 | [diff] [blame] | 107 | return print_common(id, gid2group(id), prefix); |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 108 | } |
| 109 | |
Bernhard Reutner-Fischer | 6559100 | 2008-11-05 08:15:13 +0000 | [diff] [blame] | 110 | static int print_user(uid_t id, const char *prefix) |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 111 | { |
Denis Vlasenko | 0c68a87 | 2008-12-02 22:56:59 +0000 | [diff] [blame] | 112 | return print_common(id, uid2uname(id), prefix); |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 113 | } |
| 114 | |
| 115 | /* On error set *n < 0 and return >= 0 |
| 116 | * If *n is too small, update it and return < 0 |
Denys Vlasenko | 52f4fe9 | 2011-06-22 16:42:36 +0200 | [diff] [blame] | 117 | * (ok to trash groups[] in both cases) |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 118 | * Otherwise fill in groups[] and return >= 0 |
| 119 | */ |
| 120 | static int get_groups(const char *username, gid_t rgid, gid_t *groups, int *n) |
| 121 | { |
| 122 | int m; |
| 123 | |
| 124 | if (username) { |
| 125 | /* If the user is a member of more than |
| 126 | * *n groups, then -1 is returned. Otherwise >= 0. |
| 127 | * (and no defined way of detecting errors?!) */ |
| 128 | m = getgrouplist(username, rgid, groups, n); |
| 129 | /* I guess *n < 0 might indicate error. Anyway, |
| 130 | * malloc'ing -1 bytes won't be good, so: */ |
Denys Vlasenko | 52f4fe9 | 2011-06-22 16:42:36 +0200 | [diff] [blame] | 131 | if (*n < 0) |
| 132 | return 0; |
| 133 | return m; |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 134 | } |
Denys Vlasenko | 52f4fe9 | 2011-06-22 16:42:36 +0200 | [diff] [blame] | 135 | |
| 136 | *n = getgroups(*n, groups); |
| 137 | if (*n >= 0) |
| 138 | return *n; |
| 139 | /* Error */ |
| 140 | if (errno == EINVAL) /* *n is too small? */ |
| 141 | *n = getgroups(0, groups); /* get needed *n */ |
| 142 | /* if *n >= 0, return -1 (got new *n), else return 0 (error): */ |
| 143 | return -(*n >= 0); |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 144 | } |
Denis Vlasenko | 2228426 | 2008-09-18 00:56:24 +0000 | [diff] [blame] | 145 | |
Denis Vlasenko | 9b49a5e | 2007-10-11 10:05:36 +0000 | [diff] [blame] | 146 | int id_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
Denis Vlasenko | a60f84e | 2008-07-05 09:18:54 +0000 | [diff] [blame] | 147 | int id_main(int argc UNUSED_PARAM, char **argv) |
Erik Andersen | 94f5e0b | 2000-05-01 19:10:52 +0000 | [diff] [blame] | 148 | { |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 149 | uid_t ruid; |
| 150 | gid_t rgid; |
| 151 | uid_t euid; |
| 152 | gid_t egid; |
| 153 | unsigned opt; |
| 154 | int i; |
| 155 | int status = EXIT_SUCCESS; |
| 156 | const char *prefix; |
Denis Vlasenko | 2228426 | 2008-09-18 00:56:24 +0000 | [diff] [blame] | 157 | const char *username; |
Denis Vlasenko | 49622d7 | 2007-03-10 16:58:49 +0000 | [diff] [blame] | 158 | #if ENABLE_SELINUX |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 159 | security_context_t scontext = NULL; |
Denis Vlasenko | 49622d7 | 2007-03-10 16:58:49 +0000 | [diff] [blame] | 160 | #endif |
Tito Ragusa | 33092f1 | 2011-06-21 17:11:40 +0200 | [diff] [blame] | 161 | |
| 162 | if (ENABLE_GROUPS && (!ENABLE_ID || applet_name[0] == 'g')) { |
Denys Vlasenko | d5ac9c8 | 2011-06-22 04:17:49 +0200 | [diff] [blame] | 163 | /* TODO: coreutils groups prepend "USER : " prefix, |
| 164 | * and accept many usernames. Example: |
| 165 | * # groups root root |
| 166 | * root : root |
| 167 | * root : root |
| 168 | */ |
| 169 | opt = option_mask32 = getopt32(argv, "") | JUST_ALL_GROUPS | NAME_NOT_NUMBER; |
Tito Ragusa | 33092f1 | 2011-06-21 17:11:40 +0200 | [diff] [blame] | 170 | } else { |
| 171 | /* Don't allow -n -r -nr -ug -rug -nug -rnug -uZ -gZ -GZ*/ |
| 172 | /* Don't allow more than one username */ |
Denys Vlasenko | 22542ec | 2017-08-08 21:55:02 +0200 | [diff] [blame] | 173 | opt = getopt32(argv, "^" |
| 174 | "rnugG" IF_SELINUX("Z") |
| 175 | "\0" |
| 176 | "?1:u--g:g--u:G--u:u--G:g--G:G--g:r?ugG:n?ugG" |
| 177 | IF_SELINUX(":u--Z:Z--u:g--Z:Z--g:G--Z:Z--G") |
| 178 | ); |
Tito Ragusa | 33092f1 | 2011-06-21 17:11:40 +0200 | [diff] [blame] | 179 | } |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 180 | |
Denis Vlasenko | 2228426 | 2008-09-18 00:56:24 +0000 | [diff] [blame] | 181 | username = argv[optind]; |
Denis Vlasenko | 2228426 | 2008-09-18 00:56:24 +0000 | [diff] [blame] | 182 | if (username) { |
Denis Vlasenko | d7a805e | 2008-12-03 19:05:55 +0000 | [diff] [blame] | 183 | struct passwd *p = xgetpwnam(username); |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 184 | euid = ruid = p->pw_uid; |
| 185 | egid = rgid = p->pw_gid; |
Denis Vlasenko | 2228426 | 2008-09-18 00:56:24 +0000 | [diff] [blame] | 186 | } else { |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 187 | egid = getegid(); |
| 188 | rgid = getgid(); |
| 189 | euid = geteuid(); |
| 190 | ruid = getuid(); |
Erik Andersen | 94f5e0b | 2000-05-01 19:10:52 +0000 | [diff] [blame] | 191 | } |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 192 | /* JUST_ALL_GROUPS ignores -r PRINT_REAL flag even if man page for */ |
| 193 | /* id says: print the real ID instead of the effective ID, with -ugG */ |
Bernhard Reutner-Fischer | a643816 | 2008-11-05 08:18:16 +0000 | [diff] [blame] | 194 | /* in fact in this case egid is always printed if egid != rgid */ |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 195 | if (!opt || (opt & JUST_ALL_GROUPS)) { |
| 196 | gid_t *groups; |
| 197 | int n; |
Erik Andersen | 94f5e0b | 2000-05-01 19:10:52 +0000 | [diff] [blame] | 198 | |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 199 | if (!opt) { |
| 200 | /* Default Mode */ |
| 201 | status |= print_user(ruid, "uid="); |
| 202 | status |= print_group(rgid, " gid="); |
| 203 | if (euid != ruid) |
| 204 | status |= print_user(euid, " euid="); |
| 205 | if (egid != rgid) |
| 206 | status |= print_group(egid, " egid="); |
Glenn L McGrath | f15dfc5 | 2004-09-15 03:04:08 +0000 | [diff] [blame] | 207 | } else { |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 208 | /* JUST_ALL_GROUPS */ |
| 209 | status |= print_group(rgid, NULL); |
| 210 | if (egid != rgid) |
| 211 | status |= print_group(egid, " "); |
Denis Vlasenko | c86e052 | 2007-03-20 11:30:28 +0000 | [diff] [blame] | 212 | } |
Denis Vlasenko | e7368f1 | 2008-10-29 10:30:54 +0000 | [diff] [blame] | 213 | /* We are supplying largish buffer, trying |
| 214 | * to not run get_groups() twice. That might be slow |
| 215 | * ("user database in remote SQL server" case) */ |
Denys Vlasenko | 52f4fe9 | 2011-06-22 16:42:36 +0200 | [diff] [blame] | 216 | groups = xmalloc(64 * sizeof(groups[0])); |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 217 | n = 64; |
| 218 | if (get_groups(username, rgid, groups, &n) < 0) { |
| 219 | /* Need bigger buffer after all */ |
Denys Vlasenko | 52f4fe9 | 2011-06-22 16:42:36 +0200 | [diff] [blame] | 220 | groups = xrealloc(groups, n * sizeof(groups[0])); |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 221 | get_groups(username, rgid, groups, &n); |
| 222 | } |
| 223 | if (n > 0) { |
| 224 | /* Print the list */ |
| 225 | prefix = " groups="; |
| 226 | for (i = 0; i < n; i++) { |
| 227 | if (opt && (groups[i] == rgid || groups[i] == egid)) |
| 228 | continue; |
| 229 | status |= print_group(groups[i], opt ? " " : prefix); |
| 230 | prefix = ","; |
| 231 | } |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 232 | } else if (n < 0) { /* error in get_groups() */ |
Denys Vlasenko | df7b657 | 2011-01-26 16:11:19 +0100 | [diff] [blame] | 233 | if (ENABLE_DESKTOP) |
James Byrne | 6937487 | 2019-07-02 11:35:03 +0200 | [diff] [blame] | 234 | bb_simple_error_msg_and_die("can't get groups"); |
Denys Vlasenko | df7b657 | 2011-01-26 16:11:19 +0100 | [diff] [blame] | 235 | return EXIT_FAILURE; |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 236 | } |
Denis Vlasenko | e7368f1 | 2008-10-29 10:30:54 +0000 | [diff] [blame] | 237 | if (ENABLE_FEATURE_CLEAN_UP) |
| 238 | free(groups); |
Denis Vlasenko | 49622d7 | 2007-03-10 16:58:49 +0000 | [diff] [blame] | 239 | #if ENABLE_SELINUX |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 240 | if (is_selinux_enabled()) { |
| 241 | if (getcon(&scontext) == 0) |
| 242 | printf(" context=%s", scontext); |
Denis Vlasenko | c86e052 | 2007-03-20 11:30:28 +0000 | [diff] [blame] | 243 | } |
| 244 | #endif |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 245 | } else if (opt & PRINT_REAL) { |
| 246 | euid = ruid; |
| 247 | egid = rgid; |
Eric Andersen | c1b8f12 | 2001-01-25 05:12:02 +0000 | [diff] [blame] | 248 | } |
Glenn L McGrath | f15dfc5 | 2004-09-15 03:04:08 +0000 | [diff] [blame] | 249 | |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 250 | if (opt & JUST_USER) |
| 251 | status |= print_user(euid, NULL); |
| 252 | else if (opt & JUST_GROUP) |
| 253 | status |= print_group(egid, NULL); |
Denis Vlasenko | 49622d7 | 2007-03-10 16:58:49 +0000 | [diff] [blame] | 254 | #if ENABLE_SELINUX |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 255 | else if (opt & JUST_CONTEXT) { |
| 256 | selinux_or_die(); |
| 257 | if (username || getcon(&scontext)) { |
| 258 | bb_error_msg_and_die("can't get process context%s", |
| 259 | username ? " for a different user" : ""); |
| 260 | } |
Ron Yorston | cad3fc7 | 2021-02-03 20:47:14 +0100 | [diff] [blame] | 261 | fputs_stdout(scontext); |
Eric Andersen | 7eb79ff | 2004-09-02 22:21:41 +0000 | [diff] [blame] | 262 | } |
Denis Vlasenko | 34e68c8 | 2008-10-29 00:27:31 +0000 | [diff] [blame] | 263 | /* freecon(NULL) seems to be harmless */ |
| 264 | if (ENABLE_FEATURE_CLEAN_UP) |
| 265 | freecon(scontext); |
Eric Andersen | 7eb79ff | 2004-09-02 22:21:41 +0000 | [diff] [blame] | 266 | #endif |
Denis Vlasenko | 4daad90 | 2007-09-27 10:20:47 +0000 | [diff] [blame] | 267 | bb_putchar('\n'); |
Denis Vlasenko | f0ed376 | 2006-10-26 23:21:47 +0000 | [diff] [blame] | 268 | fflush_stdout_and_exit(status); |
Erik Andersen | 94f5e0b | 2000-05-01 19:10:52 +0000 | [diff] [blame] | 269 | } |