~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/internal/my_create.cc

  • Committer: Brian Aker
  • Date: 2009-12-29 01:38:38 UTC
  • mfrom: (1251.1.1 drizzle)
  • Revision ID: brian@gaz-20091229013838-03kb2z5xbqw03ddt
Merge of Diego fix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
   along with this program; if not, write to the Free Software
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
 
#include "mysys_priv.h"
17
 
#include <my_dir.h>
18
 
#include "mysys_err.h"
 
16
#include "drizzled/internal/mysys_priv.h"
 
17
 
 
18
#include <fcntl.h>
19
19
#include <errno.h>
20
 
#include <my_sys.h>
 
20
 
 
21
#include "drizzled/internal/my_dir.h"
 
22
#include "drizzled/my_error.h"
 
23
 
21
24
        /*
22
25
        ** Create a new file
23
26
        ** Arguments:
28
31
        */
29
32
 
30
33
 
31
 
File my_create(const char *FileName, int CreateFlags, int access_flags,
32
 
               myf MyFlags)
 
34
int my_create(const char *FileName, int CreateFlags, int access_flags,
 
35
               myf MyFlags)
33
36
{
34
37
  int fd, rc;
35
38
 
47
50
    fd= -1;
48
51
  }
49
52
 
50
 
  rc= my_register_filename(fd, FileName, FILE_BY_CREATE,
51
 
                           EE_CANTCREATEFILE, MyFlags);
 
53
  rc= my_register_filename(fd, FileName, EE_CANTCREATEFILE, MyFlags);
52
54
  /*
53
55
    my_register_filename() may fail on some platforms even if the call to
54
56
    *open() above succeeds. In this case, don't leave the stale file because
57
59
  */
58
60
  if (unlikely(fd >= 0 && rc < 0))
59
61
  {
60
 
    int tmp= my_errno;
 
62
    int tmp= errno;
61
63
    my_delete(FileName, MyFlags);
62
 
    my_errno= tmp;
 
64
    errno= tmp;
63
65
  }
64
 
  
 
66
 
65
67
  return(rc);
66
68
} /* my_create */