Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 529574
Collapse All | Expand All

(-)sql/sql_class.cc.orig (-8 / +23 lines)
Lines 2618-2624 Link Here
2618
			IO_CACHE *cache)
2618
			IO_CACHE *cache)
2619
{
2619
{
2620
  File file;
2620
  File file;
2621
  MY_STAT stat;
2621
  uint option= MY_UNPACK_FILENAME | MY_RELATIVE_PATH;
2622
  uint option= MY_UNPACK_FILENAME | MY_RELATIVE_PATH;
2623
  int file_created= 0;
2622
2624
2623
#ifdef DONT_ALLOW_FULL_LOAD_DATA_PATHS
2625
#ifdef DONT_ALLOW_FULL_LOAD_DATA_PATHS
2624
  option|= MY_REPLACE_DIR;			// Force use of db directory
2626
  option|= MY_REPLACE_DIR;			// Force use of db directory
Lines 2640-2664 Link Here
2640
    return -1;
2642
    return -1;
2641
  }
2643
  }
2642
2644
2643
  if (!access(path, F_OK))
2645
  /* Check if file is a named pipe */
2646
  if (my_stat(path, &stat, MYF(0)) && MY_S_ISFIFO(stat.st_mode))
2647
  {
2648
    if ((file= mysql_file_open(key_select_to_file,
2649
                               path, O_WRONLY, MYF(MY_WME))) < 0)
2650
      return file;
2651
  }
2652
  else if (!access(path, F_OK))
2644
  {
2653
  {
2645
    my_error(ER_FILE_EXISTS_ERROR, MYF(0), exchange->file_name);
2654
    my_error(ER_FILE_EXISTS_ERROR, MYF(0), exchange->file_name);
2646
    return -1;
2655
    return -1;
2647
  }
2656
  }
2648
  /* Create the file world readable */
2657
  else
2649
  if ((file= mysql_file_create(key_select_to_file,
2658
  {
2650
                               path, 0666, O_WRONLY|O_EXCL, MYF(MY_WME))) < 0)
2659
    /* Create the file world readable */
2651
    return file;
2660
    if ((file= mysql_file_create(key_select_to_file,
2661
                                 path, 0666, O_WRONLY|O_EXCL, MYF(MY_WME))) < 0)
2662
      return file;
2652
#ifdef HAVE_FCHMOD
2663
#ifdef HAVE_FCHMOD
2653
  (void) fchmod(file, 0666);			// Because of umask()
2664
    (void) fchmod(file, 0666);			// Because of umask()
2654
#else
2665
#else
2655
  (void) chmod(path, 0666);
2666
    (void) chmod(path, 0666);
2656
#endif
2667
#endif
2668
    file_created= 1;
2669
  }
2670
2657
  if (init_io_cache(cache, file, 0L, WRITE_CACHE, 0L, 1, MYF(MY_WME)))
2671
  if (init_io_cache(cache, file, 0L, WRITE_CACHE, 0L, 1, MYF(MY_WME)))
2658
  {
2672
  {
2659
    mysql_file_close(file, MYF(0));
2673
    mysql_file_close(file, MYF(0));
2660
    /* Delete file on error, it was just created */
2674
    /* Delete file on error, it was just created */
2661
    mysql_file_delete(key_select_to_file, path, MYF(0));
2675
    if (file_created)
2676
      mysql_file_delete(key_select_to_file, path, MYF(0));
2662
    return -1;
2677
    return -1;
2663
  }
2678
  }
2664
  return file;
2679
  return file;

Return to bug 529574