Skip to content

Commit

Permalink
MDEV-23875: select into outfile not respect UMASK and UMASK_DIR
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mariadb-RuchaDeodhar committed Dec 31, 2020
1 parent 7829204 commit 4f5d5a7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sql/sql_class.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
{
Expand Down

0 comments on commit 4f5d5a7

Please sign in to comment.