summaryrefslogtreecommitdiff
path: root/scripts/mysqld_multi.sh
diff options
context:
space:
mode:
authorTatjana Azundris Nuernberg <tatjana.nuernberg@oracle.com>2012-10-17 07:36:40 +0100
committerTatjana Azundris Nuernberg <tatjana.nuernberg@oracle.com>2012-10-17 07:36:40 +0100
commit61ab1a4ba9bb4714c747e88f72a7cd96f884acd0 (patch)
treeee29e0c3eef8dd26935a5e39c87a6fe459a2ecb7 /scripts/mysqld_multi.sh
parentd974ea7f534e40bf6810c1bb5134ef64cbc78ce2 (diff)
parenta5fa073727a30fcd2fa3f99dbd937d6d810eaa32 (diff)
downloadmariadb-git-61ab1a4ba9bb4714c747e88f72a7cd96f884acd0.tar.gz
Bug#11764559: UMASK IS IGNORED BY ERROR LOG
mysqld_safe script did not heed MySQL specific environment variable $UMASK, leading to divergent behavior between mysqld and mysqld_safe. Patch adds an approximation of mysqld's behavior to mysqld_safe, within the bounds dictated by attempt to have mysqld_safe run on even the most basic of shells (proper '70s sh, not just bash with a fancy symlink). Patch also adds approximation of said behavior to mysqld_multi (in perl). (backport) manual merge
Diffstat (limited to 'scripts/mysqld_multi.sh')
-rw-r--r--scripts/mysqld_multi.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh
index fb6475b7406..bb218a9980b 100644
--- a/scripts/mysqld_multi.sh
+++ b/scripts/mysqld_multi.sh
@@ -47,6 +47,28 @@ $homedir = $ENV{HOME};
$my_progname = $0;
$my_progname =~ s/.*[\/]//;
+
+if (defined($ENV{UMASK})) {
+ my $UMASK = $ENV{UMASK};
+ my $m;
+ my $fmode = "0640";
+
+ if(($UMASK =~ m/[^0246]/) || ($UMASK =~ m/^[^0]/) || (length($UMASK) != 4)) {
+ printf("UMASK must be a 3-digit mode with an additional leading 0 to indicate octal.\n");
+ printf("The first digit will be corrected to 6, the others may be 0, 2, 4, or 6.\n"); }
+ else {
+ $fmode= substr $UMASK, 2, 2;
+ $fmode= "06${fmode}"; }
+
+ if($fmode != $UMASK) {
+ printf("UMASK corrected from $UMASK to $fmode ...\n"); }
+
+ $fmode= oct($fmode);
+
+ umask($fmode);
+}
+
+
main();
####