summaryrefslogtreecommitdiff
path: root/mysys/my_symlink.c
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@mysql.com>2008-08-23 07:47:43 +0500
committerAlexey Botchkov <holyfoot@mysql.com>2008-08-23 07:47:43 +0500
commit491dc13898e37c04f02906554d29e4449515381c (patch)
treeee21c0f34bb510966b5ed546cb41503309d9220a /mysys/my_symlink.c
parent099a80d05a03f80a7310769f2b7b13f875ef24f9 (diff)
parentec524d50a86b6fb75dc3dc5704fbed34568aa35c (diff)
downloadmariadb-git-491dc13898e37c04f02906554d29e4449515381c.tar.gz
merging
Diffstat (limited to 'mysys/my_symlink.c')
-rw-r--r--mysys/my_symlink.c47
1 files changed, 24 insertions, 23 deletions
diff --git a/mysys/my_symlink.c b/mysys/my_symlink.c
index 98059ccd508..69ce91ada5b 100644
--- a/mysys/my_symlink.c
+++ b/mysys/my_symlink.c
@@ -108,38 +108,39 @@ 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)))
+{
+ struct stat stat_buff;
+ return !lstat(filename, &stat_buff) && S_ISLNK(stat_buff.st_mode);
+}
+
+
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