Commit ce0ab709 authored by unknown's avatar unknown

Merge kaamos.(none):/data/src/opt/bug31781/my51

into  kaamos.(none):/data/src/opt/mysql-5.1-opt

parents 8a176c55 ca753c3a
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
File my_create(const char *FileName, int CreateFlags, int access_flags, File my_create(const char *FileName, int CreateFlags, int access_flags,
myf MyFlags) myf MyFlags)
{ {
int fd; int fd, rc;
DBUG_ENTER("my_create"); DBUG_ENTER("my_create");
DBUG_PRINT("my",("Name: '%s' CreateFlags: %d AccessFlags: %d MyFlags: %d", DBUG_PRINT("my",("Name: '%s' CreateFlags: %d AccessFlags: %d MyFlags: %d",
FileName, CreateFlags, access_flags, MyFlags)); FileName, CreateFlags, access_flags, MyFlags));
...@@ -52,6 +52,20 @@ File my_create(const char *FileName, int CreateFlags, int access_flags, ...@@ -52,6 +52,20 @@ File my_create(const char *FileName, int CreateFlags, int access_flags,
fd = open(FileName, access_flags); fd = open(FileName, access_flags);
#endif #endif
DBUG_RETURN(my_register_filename(fd, FileName, FILE_BY_CREATE, rc= my_register_filename(fd, FileName, FILE_BY_CREATE,
EE_CANTCREATEFILE, MyFlags)); EE_CANTCREATEFILE, MyFlags);
/*
my_register_filename() may fail on some platforms even if the call to
*open() above succeeds. In this case, don't leave the stale file because
callers assume the file to not exist if my_create() fails, so they don't
do any cleanups.
*/
if (unlikely(fd >= 0 && rc < 0))
{
int tmp= my_errno;
my_delete(FileName, MyFlags);
my_errno= tmp;
}
DBUG_RETURN(rc);
} /* my_create */ } /* my_create */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment