diff options
author | unknown <svoj@mysql.com/june.mysql.com> | 2007-11-12 15:02:42 +0400 |
---|---|---|
committer | unknown <svoj@mysql.com/june.mysql.com> | 2007-11-12 15:02:42 +0400 |
commit | a1e38552bb2d265b9bf001d1b886206e4358c368 (patch) | |
tree | 3f0113d61ea6d706ab05ab54b095fcfb333a30dd /mysys/my_symlink2.c | |
parent | ac9fea61e85c0d8fe12f0c91e2286eee55ecd9f6 (diff) | |
parent | ff4b438be005a3cffb5100db93e10da0f7980922 (diff) | |
download | mariadb-git-a1e38552bb2d265b9bf001d1b886206e4358c368.tar.gz |
Merge mysql.com:/home/svoj/devel/mysql/BUG32111/mysql-4.0
into mysql.com:/home/svoj/devel/mysql/BUG32111/mysql-4.1-engines
mysys/my_symlink2.c:
Auto merged
mysql-test/r/symlink.result:
SCCS merged
mysql-test/t/symlink.test:
SCCS merged
Diffstat (limited to 'mysys/my_symlink2.c')
-rw-r--r-- | mysys/my_symlink2.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/mysys/my_symlink2.c b/mysys/my_symlink2.c index 603248e186b..7aa4e359bb9 100644 --- a/mysys/my_symlink2.c +++ b/mysys/my_symlink2.c @@ -125,6 +125,7 @@ int my_rename_with_symlink(const char *from, const char *to, myf MyFlags) int was_symlink= (!my_disable_symlinks && !my_readlink(link_name, from, MYF(0))); int result=0; + int name_is_different; DBUG_ENTER("my_rename_with_symlink"); if (!was_symlink) @@ -133,6 +134,14 @@ int my_rename_with_symlink(const char *from, const char *to, myf MyFlags) /* Change filename that symlink pointed to */ strmov(tmp_name, to); fn_same(tmp_name,link_name,1); /* Copy dir */ + name_is_different= strcmp(link_name, tmp_name); + if (name_is_different && !access(tmp_name, F_OK)) + { + my_errno= EEXIST; + if (MyFlags & MY_WME) + my_error(EE_CANTCREATEFILE, MYF(0), tmp_name, EEXIST); + DBUG_RETURN(1); + } /* Create new symlink */ if (my_symlink(tmp_name, to, MyFlags)) @@ -144,7 +153,7 @@ int my_rename_with_symlink(const char *from, const char *to, myf MyFlags) the same basename and different directories. */ - if (strcmp(link_name, tmp_name) && my_rename(link_name, tmp_name, MyFlags)) + if (name_is_different && my_rename(link_name, tmp_name, MyFlags)) { int save_errno=my_errno; my_delete(to, MyFlags); /* Remove created symlink */ |