~n-muench/ubuntu/oneiric/open-vm-tools/open-vm-tools.fix-836277

« back to all changes in this revision

Viewing changes to modules/freebsd/vmhgfs/cpNameLinux.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2008-11-20 21:56:00 UTC
  • mfrom: (1.1.3 upstream) (2.2.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20081120215600-0jujiv17a2ja92xu
Tags: 2008.11.18-130226-1
* Replacing obsolete dh_clean -k with dh_prep.
* Merging upstream version 2008.11.18-130226.
* Updating debian directory for addition of pvscsi and vmxnet3 modules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
#include "cpName.h"
32
32
#include "cpNameInt.h"
33
33
#include "vm_assert.h"
34
 
 
35
 
 
36
 
/*
37
 
 *----------------------------------------------------------------------
38
 
 *
39
 
 * CPName_GetComponent --
40
 
 *
41
 
 *    Get the next component of the CP name.
42
 
 *
43
 
 *    Returns the length of the component starting with the begin
44
 
 *    pointer, and a pointer to the next component in the buffer, if
45
 
 *    any. The "next" pointer is set to "end" if there is no next
46
 
 *    component.
47
 
 *
48
 
 * Results:
49
 
 *    length (not including NUL termination) >= 0 of next
50
 
 *    component on success.
51
 
 *    error < 0 on failure (invalid component).
52
 
 *
53
 
 * Side effects:
54
 
 *    None
55
 
 *
56
 
 *----------------------------------------------------------------------
57
 
 */
58
 
 
59
 
int
60
 
CPName_GetComponent(char const *begin,  // IN: Beginning of buffer
61
 
                    char const *end,    // IN: End of buffer
62
 
                    char const **next)  // OUT: Start of next component
63
 
{
64
 
   ASSERT(begin);
65
 
   ASSERT(end);
66
 
   ASSERT(next);
67
 
 
68
 
   /*
69
 
    * '/' is not a legal character on Linux, since it is a path
70
 
    * separator.
71
 
    */
72
 
   return CPName_GetComponentGeneric(begin, end, "/", next);
73
 
}
 
34
#include "hgfsEscape.h"
74
35
 
75
36
 
76
37
/*
104
65
   ASSERT(outSize);
105
66
   ASSERT(bufOut);
106
67
 
107
 
   return CPNameConvertFrom(bufIn, inSize, outSize, bufOut, '/');
 
68
   return CPNameEscapeAndConvertFrom(bufIn, inSize, outSize, bufOut, '/');
108
69
}
109
70
 
110
71
 
188
149
 *
189
150
 *    Makes a cross-platform name representation from the Linux path input
190
151
 *    string and writes it into the output buffer.
 
152
 *    If the name being converter may be a result a of name escaping the
 
153
 *    function performs unescaping. HGFS convention is to always exchange
 
154
 *    unescaped names between guest and host and to perform necessary
 
155
 *    name escaping on both ends.
191
156
 *
192
157
 * Results:
193
158
 *    On success, returns the number of bytes used in the
205
170
                 size_t bufOutSize,  // IN:  Size of the output buffer
206
171
                 char *bufOut)       // OUT: Output buffer
207
172
{
208
 
   return CPName_LinuxConvertTo(nameIn, bufOutSize, bufOut);
 
173
   int result;
 
174
   result = CPName_LinuxConvertTo(nameIn, bufOutSize, bufOut);
 
175
   if (result > 0) {
 
176
      result = HgfsEscape_Undo(bufOut, result);
 
177
   }
 
178
   return result;
209
179
}