~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/mf_format.cc

  • Committer: Brian Aker
  • Date: 2009-06-24 23:17:45 UTC
  • mfrom: (1060.2.7 rm_my_symlink)
  • Revision ID: brian@gaz-20090624231745-rhuamlvq4zkt70xp
Merge EricL tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
    realpath if the file is a symbolic link
97
97
  */
98
98
  if (flag & MY_RETURN_REAL_PATH)
99
 
    (void) my_realpath(to, to, MYF(flag & MY_RESOLVE_SYMLINKS ?
100
 
                                   MY_RESOLVE_LINK: 0));
 
99
  {
 
100
    struct stat stat_buff;
 
101
    char rp_buff[PATH_MAX];
 
102
    if ((!flag & MY_RESOLVE_SYMLINKS) || 
 
103
       (!lstat(to,&stat_buff) && S_ISLNK(stat_buff.st_mode)))
 
104
    {
 
105
      if (!realpath(to,rp_buff))
 
106
        my_load_path(rp_buff, to, NULL);
 
107
      rp_buff[FN_REFLEN-1]= '\0';
 
108
      strcpy(to,rp_buff);
 
109
    }
 
110
  }
101
111
  else if (flag & MY_RESOLVE_SYMLINKS)
102
112
  {
103
113
    strcpy(buff,to);
104
 
    (void) my_readlink(to, buff, MYF(0));
 
114
    ssize_t sym_link_size= readlink(buff,to,FN_REFLEN-1);
 
115
    if (sym_link_size >= 0)
 
116
      to[sym_link_size]= '\0';
105
117
  }
106
118
  return(to);
107
119
} /* fn_format */