diff options
author | Joerg Bruehe <joerg@mysql.com> | 2008-09-10 21:11:22 +0200 |
---|---|---|
committer | Joerg Bruehe <joerg@mysql.com> | 2008-09-10 21:11:22 +0200 |
commit | 92d3010dc1bb4b20c020f7e41850fdebf9cb05c2 (patch) | |
tree | 106b752143b44914c06a67c0d60ad81020e47fbe /mysys | |
parent | 8106a731e6671779d3be855f766069cc2774be34 (diff) | |
parent | 31d76e8d526da59070f0c75cae0b9672c11a1b03 (diff) | |
download | mariadb-git-92d3010dc1bb4b20c020f7e41850fdebf9cb05c2.tar.gz |
Merge main 5.0 into 5.0-build.
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/my_symlink.c | 55 | ||||
-rw-r--r-- | mysys/thr_lock.c | 2 |
2 files changed, 33 insertions, 24 deletions
diff --git a/mysys/my_symlink.c b/mysys/my_symlink.c index 810c0c72632..7f2be5644e8 100644 --- a/mysys/my_symlink.c +++ b/mysys/my_symlink.c @@ -106,38 +106,47 @@ int my_symlink(const char *content, const char *linkname, myf MyFlags) #define BUFF_LEN FN_LEN #endif + +int my_is_symlink(const char *filename __attribute__((unused))) +{ +#if defined (HAVE_LSTAT) && defined (S_ISLNK) + struct stat stat_buff; + return !lstat(filename, &stat_buff) && S_ISLNK(stat_buff.st_mode); +#elif defined (_WIN32) + DWORD dwAttr = GetFileAttributes(filename); + return (dwAttr != INVALID_FILE_ATTRIBUTES) && + (dwAttr & FILE_ATTRIBUTE_REPARSE_POINT); +#else /* No symlinks */ + return 0; +#endif +} + + int my_realpath(char *to, const char *filename, myf MyFlags __attribute__((unused))) { #if defined(HAVE_REALPATH) && !defined(HAVE_purify) && !defined(HAVE_BROKEN_REALPATH) int result=0; char buff[BUFF_LEN]; - struct stat stat_buff; + char *ptr; DBUG_ENTER("my_realpath"); - if (!(MyFlags & MY_RESOLVE_LINK) || - (!lstat(filename,&stat_buff) && S_ISLNK(stat_buff.st_mode))) - { - char *ptr; - DBUG_PRINT("info",("executing realpath")); - if ((ptr=realpath(filename,buff))) - { + DBUG_PRINT("info",("executing realpath")); + if ((ptr=realpath(filename,buff))) strmake(to,ptr,FN_REFLEN-1); - } - else - { - /* - Realpath didn't work; Use my_load_path() which is a poor substitute - original name but will at least be able to resolve paths that starts - with '.'. - */ - DBUG_PRINT("error",("realpath failed with errno: %d", errno)); - my_errno=errno; - if (MyFlags & MY_WME) - my_error(EE_REALPATH, MYF(0), filename, my_errno); - my_load_path(to, filename, NullS); - result= -1; - } + else + { + /* + Realpath didn't work; Use my_load_path() which is a poor substitute + original name but will at least be able to resolve paths that starts + with '.'. + */ + DBUG_PRINT("error",("realpath failed with errno: %d", errno)); + my_errno=errno; + if (MyFlags & MY_WME) + my_error(EE_REALPATH, MYF(0), filename, my_errno); + my_load_path(to, filename, NullS); + result= -1; } DBUG_RETURN(result); #else diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c index 02c9f08c946..853e1f96b49 100644 --- a/mysys/thr_lock.c +++ b/mysys/thr_lock.c @@ -333,10 +333,10 @@ void thr_lock_init(THR_LOCK *lock) void thr_lock_delete(THR_LOCK *lock) { DBUG_ENTER("thr_lock_delete"); - VOID(pthread_mutex_destroy(&lock->mutex)); pthread_mutex_lock(&THR_LOCK_lock); thr_lock_thread_list=list_delete(thr_lock_thread_list,&lock->list); pthread_mutex_unlock(&THR_LOCK_lock); + pthread_mutex_destroy(&lock->mutex); DBUG_VOID_RETURN; } |