~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/internal/my_create.cc

  • Committer: Daniel Nichter
  • Date: 2011-10-23 16:01:37 UTC
  • mto: This revision was merged to the branch mainline in revision 2448.
  • Revision ID: daniel@percona.com-20111023160137-7ac3blgz8z4tf8za
Add Administration Getting Started and Logging.  Capitalize SQL clause keywords.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
 
 
16
 
#include "mysys_priv.h"
17
 
#include <my_dir.h>
18
 
#include "mysys_err.h"
 
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
15
 
 
16
#include <config.h>
 
17
 
 
18
#include <drizzled/internal/my_sys.h>
 
19
 
 
20
#include <fcntl.h>
19
21
#include <errno.h>
20
 
#include <my_sys.h>
 
22
 
 
23
#include <drizzled/error.h>
 
24
 
21
25
        /*
22
26
        ** Create a new file
23
27
        ** Arguments:
27
31
        ** Special flags
28
32
        */
29
33
 
 
34
namespace drizzled
 
35
{
 
36
namespace internal
 
37
{
30
38
 
31
 
File my_create(const char *FileName, int CreateFlags, int access_flags,
32
 
               myf MyFlags)
 
39
int my_create(const char *FileName, int CreateFlags, int access_flags,
 
40
              myf MyFlags)
33
41
{
34
42
  int fd, rc;
35
43
 
47
55
    fd= -1;
48
56
  }
49
57
 
50
 
  rc= my_register_filename(fd, FileName, FILE_BY_CREATE,
51
 
                           EE_CANTCREATEFILE, MyFlags);
 
58
  rc= my_register_filename(fd, FileName, EE_CANTCREATEFILE, MyFlags);
52
59
  /*
53
60
    my_register_filename() may fail on some platforms even if the call to
54
61
    *open() above succeeds. In this case, don't leave the stale file because
57
64
  */
58
65
  if (unlikely(fd >= 0 && rc < 0))
59
66
  {
60
 
    int tmp= my_errno;
 
67
    int tmp= errno;
61
68
    my_delete(FileName, MyFlags);
62
 
    my_errno= tmp;
 
69
    errno= tmp;
63
70
  }
64
 
  
 
71
 
65
72
  return(rc);
66
73
} /* my_create */
 
74
 
 
75
} /* namespace internal */
 
76
} /* namespace drizzled */