diff options
author | Ron Yorston <rmy@pobox.com> | 2023-12-05 07:44:02 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2023-12-05 07:44:02 +0000 |
commit | 7dff7f37600209353cf4e86d1cca29bacf5f7372 (patch) | |
tree | fd2d62684e46663ebd435391058dcf8558c6b70d /coreutils/install.c | |
parent | f444dc586b16c104a82d201d3a7caca68affe51b (diff) | |
parent | 28f41260935852eda6bd8ab1f26347c012ae0a53 (diff) | |
download | busybox-w32-7dff7f37600209353cf4e86d1cca29bacf5f7372.tar.gz busybox-w32-7dff7f37600209353cf4e86d1cca29bacf5f7372.tar.bz2 busybox-w32-7dff7f37600209353cf4e86d1cca29bacf5f7372.zip |
Merge branch 'busybox' into mergeFRP-5236-g7dff7f376
Diffstat (limited to 'coreutils/install.c')
-rw-r--r-- | coreutils/install.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/coreutils/install.c b/coreutils/install.c index c0f1c538a..00f8be87e 100644 --- a/coreutils/install.c +++ b/coreutils/install.c | |||
@@ -244,6 +244,15 @@ int install_main(int argc, char **argv) | |||
244 | } | 244 | } |
245 | } | 245 | } |
246 | 246 | ||
247 | /* Set the user and group id */ | ||
248 | /* (must be before chmod, or else chown may clear suid/gid bits) */ | ||
249 | if ((opts & (OPT_OWNER|OPT_GROUP)) | ||
250 | && lchown(dest, uid, gid) == -1 | ||
251 | ) { | ||
252 | bb_perror_msg("can't change %s of %s", "ownership", dest); | ||
253 | ret = EXIT_FAILURE; | ||
254 | } | ||
255 | |||
247 | /* Set the file mode (always, not only with -m). | 256 | /* Set the file mode (always, not only with -m). |
248 | * GNU coreutils 6.10 is not affected by umask. */ | 257 | * GNU coreutils 6.10 is not affected by umask. */ |
249 | if (chmod(dest, mode) == -1) { | 258 | if (chmod(dest, mode) == -1) { |
@@ -254,13 +263,6 @@ int install_main(int argc, char **argv) | |||
254 | if (use_default_selinux_context) | 263 | if (use_default_selinux_context) |
255 | setdefaultfilecon(dest); | 264 | setdefaultfilecon(dest); |
256 | #endif | 265 | #endif |
257 | /* Set the user and group id */ | ||
258 | if ((opts & (OPT_OWNER|OPT_GROUP)) | ||
259 | && lchown(dest, uid, gid) == -1 | ||
260 | ) { | ||
261 | bb_perror_msg("can't change %s of %s", "ownership", dest); | ||
262 | ret = EXIT_FAILURE; | ||
263 | } | ||
264 | next: | 266 | next: |
265 | if (ENABLE_FEATURE_CLEAN_UP && isdir) | 267 | if (ENABLE_FEATURE_CLEAN_UP && isdir) |
266 | free(dest); | 268 | free(dest); |