summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2001-06-05 03:38:10 +0300
committerunknown <monty@hundin.mysql.fi>2001-06-05 03:38:10 +0300
commitfe1842d9ee1a7e51f74ca192d3181968f16a0b29 (patch)
tree0630af7b21e80e56fc1ef68e9c7d0fa7233958a1 /mysys
parentc866beb5132157903765327fef1c71693d2204ae (diff)
downloadmariadb-git-fe1842d9ee1a7e51f74ca192d3181968f16a0b29.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. client/mysqltest.c: Fixed bug that error numbers wasn't tested properly. myisam/mi_check.c: Moved initialization of variables to avoid a bug. myisam/mi_create.c: Fixed bug in symlink handling. myisam/mi_test_all.sh: Fixed script so that it works. myisam/myisamchk.c: Removed --no-symlinks option mysql-test/mysql-test-run.sh: Cleaned up error message mysql-test/t/bdb.test: Fixed wrong error numbers mysql-test/t/err000001.test: Fixed wrong error numbers mysql-test/t/innodb.test: Fixed wrong error numbers mysql-test/t/overflow.test: Fixed wrong error numbers mysql-test/t/status.test: Ensure that we are using myisam tables for the lock test. mysys/my_delete.c: cleanup mysys/my_symlink2.c: Added option to not overwrite files when using symlinks. sql/Makefile.am: Moved vio to avoid link error. sql/ha_myisam.cc: Fixed symlink handling. sql/mysqld.cc: Changed --skip-symlinks to --skip-symlink sql/sql_insert.cc: Fixed that error number from insert delayed is reported correctly sql/sql_parse.cc: Fixed symlink handling. sql/sql_table.cc: Fixed symlink handling. vio/vio.c: cleanup vio/viosocket.c: c
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)