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).
This commit is contained in:
Tatjana Azundris Nuernberg
2012-10-17 07:22:06 +01:00
parent bdb4104cf6
commit b86aea6ce5
2 changed files with 56 additions and 1 deletions

View File

@ -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();
####