diff options
author | monty@hundin.mysql.fi <> | 2001-06-05 03:38:10 +0300 |
---|---|---|
committer | monty@hundin.mysql.fi <> | 2001-06-05 03:38:10 +0300 |
commit | 4cbe66582c984434f43a12c06238fe067983d968 (patch) | |
tree | 0630af7b21e80e56fc1ef68e9c7d0fa7233958a1 /mysys/my_symlink2.c | |
parent | a0b2ddd4dda959af15dc5462ab938eb29029b200 (diff) | |
download | mariadb-git-4cbe66582c984434f43a12c06238fe067983d968.tar.gz |
Symlinking of tables should not work.
Fixed error number handling bug in mysqltest.
Fixed that error number from insert delayed is reported correctly.
merged new vio code with old violite code.
Diffstat (limited to 'mysys/my_symlink2.c')
-rw-r--r-- | mysys/my_symlink2.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/mysys/my_symlink2.c b/mysys/my_symlink2.c index f1e90abaa9b..e77815df12a 100644 --- a/mysys/my_symlink2.c +++ b/mysys/my_symlink2.c @@ -23,6 +23,7 @@ */ #include "mysys_priv.h" +#include "mysys_err.h" #include <m_string.h> File my_create_with_symlink(const char *linkname, const char *filename, @@ -30,11 +31,27 @@ File my_create_with_symlink(const char *linkname, const char *filename, { File file; int tmp_errno; + /* Test if we should create a link */ + int create_link=(linkname && strcmp(linkname,filename)); DBUG_ENTER("my_create_with_symlink"); + + if (!(MyFlags & MY_DELETE_OLD)) + { + if (!access(filename,F_OK)) + { + my_error(EE_CANTCREATEFILE, MYF(0), filename, EEXIST); + DBUG_RETURN(-1); + } + if (create_link && !access(linkname,F_OK)) + { + my_error(EE_CANTCREATEFILE, MYF(0), linkname, EEXIST); + DBUG_RETURN(-1); + } + } + if ((file=my_create(filename, createflags, access_flags, MyFlags)) >= 0) { - /* Test if we should create a link */ - if (linkname && strcmp(linkname,filename)) + if (create_link) { /* Delete old link/file */ if (MyFlags & MY_DELETE_OLD) |