~ubuntu-branches/ubuntu/quantal/open-vm-tools/quantal-201207201942

« back to all changes in this revision

Viewing changes to modules/linux/vmhgfs/link.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2009-10-18 12:28:19 UTC
  • mfrom: (1.1.7 upstream) (2.4.9 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091018122819-00vqew6m0ztpqcqp
Tags: 2009.10.15-201664-1
MergingĀ upstreamĀ versionĀ 2009.10.15-201664.

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
#endif
88
88
{
89
89
   HgfsAttrInfo attr;
 
90
   char *fileName = NULL;
90
91
   int error;
91
92
 
92
93
   ASSERT(dentry);
100
101
 
101
102
   LOG(6, (KERN_DEBUG "VMware hgfs: HgfsFollowlink: calling "
102
103
           "HgfsPrivateGetattr\n"));
103
 
   attr.fileName = NULL;
104
 
   error = HgfsPrivateGetattr(dentry, &attr);
 
104
   error = HgfsPrivateGetattr(dentry, &attr, &fileName);
105
105
   if (!error) {
106
106
 
107
107
      /* Let's make sure we got called on a symlink. */
108
 
      if (attr.type != HGFS_FILE_TYPE_SYMLINK ||
109
 
          attr.fileName == NULL) {
 
108
      if (attr.type != HGFS_FILE_TYPE_SYMLINK || fileName == NULL) {
110
109
         LOG(6, (KERN_DEBUG "VMware hgfs: HgfsFollowlink: got called "
111
110
                 "on something that wasn't a symlink\n"));
112
111
         error = -EINVAL;
113
112
      } else {
114
113
         LOG(6, (KERN_DEBUG "VMware hgfs: HgfsFollowlink: calling "
115
114
                 "vfs_follow_link\n"));
116
 
         error = vfs_follow_link(nd, attr.fileName);
 
115
         error = vfs_follow_link(nd, fileName);
117
116
      }
118
 
      kfree(attr.fileName);
 
117
      kfree(fileName);
119
118
   }
120
119
  out:
121
120
 
151
150
 
152
151
{
153
152
   HgfsAttrInfo attr;
 
153
   char *fileName = NULL;
154
154
   int error;
155
155
 
156
156
   ASSERT(dentry);
163
163
 
164
164
   LOG(6, (KERN_DEBUG "VMware hgfs: HgfsReadlink: calling "
165
165
           "HgfsPrivateGetattr\n"));
166
 
   attr.fileName = NULL;
167
 
   error = HgfsPrivateGetattr(dentry, &attr);
 
166
   error = HgfsPrivateGetattr(dentry, &attr, &fileName);
168
167
   if (!error) {
169
168
 
170
169
      /* Let's make sure we got called on a symlink. */
171
 
      if (attr.type != HGFS_FILE_TYPE_SYMLINK ||
172
 
          attr.fileName == NULL) {
 
170
      if (attr.type != HGFS_FILE_TYPE_SYMLINK || fileName == NULL) {
173
171
         LOG(6, (KERN_DEBUG "VMware hgfs: HgfsReadlink: got called "
174
172
                 "on something that wasn't a symlink\n"));
175
173
         error = -EINVAL;
176
174
      } else {
177
175
         LOG(6, (KERN_DEBUG "VMware hgfs: HgfsReadlink: calling "
178
176
                 "vfs_readlink\n"));
179
 
         error = vfs_readlink(dentry, buffer, buflen, attr.fileName);
 
177
         error = vfs_readlink(dentry, buffer, buflen, fileName);
180
178
      }
181
 
      kfree(attr.fileName);
 
179
      kfree(fileName);
182
180
   }
183
181
   return error;
184
182
}