summaryrefslogtreecommitdiff
path: root/sql/sql_class.cc
diff options
context:
space:
mode:
authorRucha Deodhar <rucha.deodhar@mariadb.com>2020-12-28 21:27:27 +0530
committerRucha Deodhar <rucha.deodhar@mariadb.com>2020-12-31 14:17:22 +0530
commit4f5d5a7857b48b6c34608f1e8dc2fe354cacd373 (patch)
treee69fa877e4ad44b85b2c7985eb2c72923e5c6008 /sql/sql_class.cc
parent78292047a4747ccd9210ba36a185a1dbe825de89 (diff)
downloadmariadb-git-4f5d5a7857b48b6c34608f1e8dc2fe354cacd373.tar.gz
MDEV-23875: select into outfile not respect UMASK and UMASK_DIR
Analysis: select into outfile creates files everytime with 666 permission, regardsless if umask environment variables and umask settings on OS level. It seems hardcoded. Fix: change 0666 to 0644 which will let anybody consume the file but not change it.
Diffstat (limited to 'sql/sql_class.cc')
-rw-r--r--sql/sql_class.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 7eaafbd9044..b16a750aa9b 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -2859,12 +2859,12 @@ static File create_file(THD *thd, char *path, sql_exchange *exchange,
}
/* Create the file world readable */
if ((file= mysql_file_create(key_select_to_file,
- path, 0666, O_WRONLY|O_EXCL, MYF(MY_WME))) < 0)
+ path, 0644, O_WRONLY|O_EXCL, MYF(MY_WME))) < 0)
return file;
#ifdef HAVE_FCHMOD
- (void) fchmod(file, 0666); // Because of umask()
+ (void) fchmod(file, 0644); // Because of umask()
#else
- (void) chmod(path, 0666);
+ (void) chmod(path, 0644;
#endif
if (init_io_cache(cache, file, 0L, WRITE_CACHE, 0L, 1, MYF(MY_WME)))
{