diff options
author | Cem Keylan <cem@ckyln.com> | 2020-04-23 00:35:57 +0300 |
---|---|---|
committer | Cem Keylan <cem@ckyln.com> | 2020-04-23 00:35:57 +0300 |
commit | 4d00567bf269b7e5cd2bc53b45c9282a726eaaa1 (patch) | |
tree | 9653616716f9add193e2c0399e378dd99983506c /core/busybox/patches/install-fix-chown.patch | |
parent | 6685001a647c8810802c4fdab3279909a7d58ef1 (diff) | |
download | repository-4d00567bf269b7e5cd2bc53b45c9282a726eaaa1.tar.gz |
busybox: apply patches
Diffstat (limited to 'core/busybox/patches/install-fix-chown.patch')
-rw-r--r-- | core/busybox/patches/install-fix-chown.patch | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/core/busybox/patches/install-fix-chown.patch b/core/busybox/patches/install-fix-chown.patch new file mode 100644 index 00000000..31ecd3c8 --- /dev/null +++ b/core/busybox/patches/install-fix-chown.patch @@ -0,0 +1,36 @@ +chown must precede chmod because on some systems, +chown clears the set[ug]id bits for non-superusers, +resulting in incorrect permissions. +diff --git a/coreutils/install.c b/coreutils/install.c +index 8270490..0256aeb 100644 +--- a/coreutils/install.c ++++ b/coreutils/install.c +@@ -244,6 +244,14 @@ int install_main(int argc, char **argv) + } + } + ++ /* Set the user and group id */ ++ if ((opts & (OPT_OWNER|OPT_GROUP)) ++ && lchown(dest, uid, gid) == -1 ++ ) { ++ bb_perror_msg("can't change %s of %s", "ownership", dest); ++ ret = EXIT_FAILURE; ++ } ++ + /* Set the file mode (always, not only with -m). + * GNU coreutils 6.10 is not affected by umask. */ + if (chmod(dest, mode) == -1) { +@@ -254,13 +262,6 @@ int install_main(int argc, char **argv) + if (use_default_selinux_context) + setdefaultfilecon(dest); + #endif +- /* Set the user and group id */ +- if ((opts & (OPT_OWNER|OPT_GROUP)) +- && lchown(dest, uid, gid) == -1 +- ) { +- bb_perror_msg("can't change %s of %s", "ownership", dest); +- ret = EXIT_FAILURE; +- } + next: + if (ENABLE_FEATURE_CLEAN_UP && isdir) + free(dest); |