~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/mf_tempfile.c

  • Committer: Monty Taylor
  • Date: 2008-10-23 23:53:49 UTC
  • mto: This revision was merged to the branch mainline in revision 557.
  • Revision ID: monty@inaugust.com-20081023235349-317wgwqwgccuacmq
SplitĀ outĀ nested_join.h.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
    implementation, it's main use is to generate a file with
46
46
    a name that does not already exist.
47
47
 
48
 
    When passing O_TEMPORARY flag in "mode" the file should
49
 
    be automatically deleted
50
 
 
51
48
    The implementation using mkstemp should be considered the
52
49
    reference implementation when adding a new or modifying an
53
50
    existing one
67
64
  {
68
65
    strmake(to,res,FN_REFLEN-1);
69
66
    (*free)(res);
70
 
    file=my_create(to, 0, mode | O_EXCL | O_NOFOLLOW, MyFlags);
 
67
    file=my_create(to, 0, mode | O_EXCL, MyFlags);
71
68
  }
72
69
#elif defined(HAVE_MKSTEMP)
73
70
  {
88
85
    }
89
86
    my_stpcpy(convert_dirname(to,dir,NULL),prefix_buff);
90
87
    org_file=mkstemp(to);
91
 
    if (mode & O_TEMPORARY)
 
88
    /* TODO: This was old behavior, but really don't we want to 
 
89
     * unlink files immediately under all circumstances?
 
90
     * if (mode & O_TEMPORARY)
92
91
      (void) my_delete(to, MYF(MY_WME | ME_NOINPUT));
 
92
     */
93
93
    file=my_register_filename(org_file, to, FILE_BY_MKSTEMP,
94
94
                              EE_CANTCREATEFILE, MyFlags);
95
95
    /* If we didn't manage to register the name, remove the temp file */
121
121
      strmake(to,res,FN_REFLEN-1);
122
122
      (*free)(res);
123
123
      file=my_create(to,0,
124
 
                     (int) (O_RDWR | O_BINARY | O_TRUNC | O_EXCL | O_NOFOLLOW |
125
 
                            O_TEMPORARY | O_SHORT_LIVED),
 
124
                     (int) (O_RDWR | O_TRUNC | O_EXCL),
126
125
                     MYF(MY_WME));
127
126
 
128
127
    }