mirror of
https://github.com/MariaDB/server.git
synced 2025-07-23 00:55:06 +00:00
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:
@ -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();
|
||||
|
||||
####
|
||||
|
Reference in New Issue
Block a user