~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_create.c

  • Committer: Brian Aker
  • Date: 2008-07-28 18:01:38 UTC
  • Revision ID: brian@tangent.org-20080728180138-q2pxlq0qiapvqsdn
Remove YEAR field type

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 "drizzled/internal/mysys_priv.h"
17
 
 
18
 
#include <fcntl.h>
 
16
#include "mysys_priv.h"
 
17
#include <my_dir.h>
 
18
#include "mysys_err.h"
19
19
#include <errno.h>
20
 
 
21
 
#include "drizzled/internal/my_dir.h"
22
 
#include "drizzled/my_error.h"
23
 
 
 
20
#include <my_sys.h>
24
21
        /*
25
22
        ** Create a new file
26
23
        ** Arguments:
31
28
        */
32
29
 
33
30
 
34
 
int my_create(const char *FileName, int CreateFlags, int access_flags,
35
 
               myf MyFlags)
 
31
File my_create(const char *FileName, int CreateFlags, int access_flags,
 
32
               myf MyFlags)
36
33
{
37
34
  int fd, rc;
38
35
 
39
36
#if !defined(NO_OPEN_3)
40
 
  fd = open(FileName, access_flags | O_CREAT,
 
37
  fd = open((char *) FileName, access_flags | O_CREAT,
41
38
            CreateFlags ? CreateFlags : my_umask);
42
39
#else
43
40
  fd = open(FileName, access_flags);
50
47
    fd= -1;
51
48
  }
52
49
 
53
 
  rc= my_register_filename(fd, FileName, EE_CANTCREATEFILE, MyFlags);
 
50
  rc= my_register_filename(fd, FileName, FILE_BY_CREATE,
 
51
                           EE_CANTCREATEFILE, MyFlags);
54
52
  /*
55
53
    my_register_filename() may fail on some platforms even if the call to
56
54
    *open() above succeeds. In this case, don't leave the stale file because
59
57
  */
60
58
  if (unlikely(fd >= 0 && rc < 0))
61
59
  {
62
 
    int tmp= errno;
 
60
    int tmp= my_errno;
63
61
    my_delete(FileName, MyFlags);
64
 
    errno= tmp;
 
62
    my_errno= tmp;
65
63
  }
66
 
 
 
64
  
67
65
  return(rc);
68
66
} /* my_create */