~ubuntu-branches/ubuntu/maverick/mysql-5.1/maverick-proposed

« back to all changes in this revision

Viewing changes to mysys/my_symlink.c

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 14:16:05 UTC
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: package-import@ubuntu.com-20120222141605-nxlu9yzc6attylc2
Tags: upstream-5.1.61
ImportĀ upstreamĀ versionĀ 5.1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2000 MySQL AB
 
1
/*
 
2
   Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
2
3
 
3
4
   This program is free software; you can redistribute it and/or modify
4
5
   it under the terms of the GNU General Public License as published by
11
12
 
12
13
   You should have received a copy of the GNU General Public License
13
14
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
 
16
*/
15
17
 
16
18
#include "mysys_priv.h"
17
19
#include "mysys_err.h"
113
115
#endif
114
116
}
115
117
 
116
 
 
117
118
/*
118
119
  Resolve all symbolic links in path
119
120
  'to' may be equal to 'filename'
120
121
*/
121
122
 
122
 
int my_realpath(char *to, const char *filename,
123
 
                myf MyFlags __attribute__((unused)))
 
123
int my_realpath(char *to, const char *filename, myf MyFlags)
124
124
{
125
125
#if defined(HAVE_REALPATH) && !defined(HAVE_BROKEN_REALPATH)
126
126
  int result=0;
146
146
    result= -1;
147
147
  }
148
148
  DBUG_RETURN(result);
 
149
#elif defined(_WIN32)
 
150
  int ret= GetFullPathName(filename,FN_REFLEN, to, NULL);
 
151
  if (ret == 0 || ret > FN_REFLEN)
 
152
  {
 
153
    my_errno= (ret > FN_REFLEN) ? ENAMETOOLONG : GetLastError();
 
154
    if (MyFlags & MY_WME)
 
155
      my_error(EE_REALPATH, MYF(0), filename, my_errno);
 
156
    /* 
 
157
      GetFullPathName didn't work : use my_load_path() which is a poor 
 
158
      substitute original name but will at least be able to resolve 
 
159
      paths that starts with '.'.
 
160
    */  
 
161
    my_load_path(to, filename, NullS);
 
162
    return -1;
 
163
  }
149
164
#else
150
165
  my_load_path(to, filename, NullS);
 
166
#endif
151
167
  return 0;
152
 
#endif
153
168
}