diff options
author | Tatjana Azundris Nuernberg <tatjana.nuernberg@oracle.com> | 2012-10-17 07:22:06 +0100 |
---|---|---|
committer | Tatjana Azundris Nuernberg <tatjana.nuernberg@oracle.com> | 2012-10-17 07:22:06 +0100 |
commit | a5fa073727a30fcd2fa3f99dbd937d6d810eaa32 (patch) | |
tree | ceb31e96c7072217a64765e98f515918fad905f2 /scripts/mysqld_multi.sh | |
parent | c55dd6bd4acc61181cd0737388516bbc70c8e000 (diff) | |
download | mariadb-git-a5fa073727a30fcd2fa3f99dbd937d6d810eaa32.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).
Diffstat (limited to 'scripts/mysqld_multi.sh')
-rw-r--r-- | scripts/mysqld_multi.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh index 8a4d0d44203..5bf59ae27be 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(); #### |