summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authormonty@hundin.mysql.fi <>2001-06-05 03:38:10 +0300
committermonty@hundin.mysql.fi <>2001-06-05 03:38:10 +0300
commit4cbe66582c984434f43a12c06238fe067983d968 (patch)
tree0630af7b21e80e56fc1ef68e9c7d0fa7233958a1 /mysys
parenta0b2ddd4dda959af15dc5462ab938eb29029b200 (diff)
downloadmariadb-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')
-rw-r--r--mysys/my_delete.c1
-rw-r--r--mysys/my_symlink2.c21
2 files changed, 19 insertions, 3 deletions
diff --git a/mysys/my_delete.c b/mysys/my_delete.c
index 77d5f311418..dc1e292a893 100644
--- a/mysys/my_delete.c
+++ b/mysys/my_delete.c
@@ -16,7 +16,6 @@
MA 02111-1307, USA */
#include "mysys_priv.h"
-
#include "mysys_err.h"
int my_delete(const char *name, myf MyFlags)
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)