Skip to content

Commit 837780b

Browse files
committed
Cygwin: docs: flesh out docs for cygwin_conv_path.
Explicitly specify that `from` and `to` are NUL-terminated strings, that NULL is permitted in `to` when `size` is 0, and that `to` is not written to in the event of an error (unless it was a fault while writing to `to`). Signed-off-by: Jeremy Drake <[email protected]>
1 parent 2c4eeea commit 837780b

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

winsup/doc/path.xml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333

3434
<refsect1 id="func-cygwin-conv-path-desc">
3535
<title>Description</title>
36-
<para>Use this function to convert POSIX paths in
37-
<parameter>from</parameter> to Win32 paths in <parameter>to</parameter>
38-
or, vice versa, Win32 paths in <parameter>from</parameter> to POSIX paths
39-
in <parameter>to</parameter>. <parameter>what</parameter>
40-
defines the direction of this conversion and can be any of the below
41-
values.</para>
36+
<para>Use this function to convert NUL-terminated POSIX paths in
37+
<parameter>from</parameter> to NUL-terminated Win32 paths in
38+
<parameter>to</parameter> or, vice versa, NUL-terminated Win32 paths in
39+
<parameter>from</parameter> to NUL-terminated POSIX paths in
40+
<parameter>to</parameter>. <parameter>what</parameter> defines the
41+
direction of this conversion and can be any of the below values.</para>
4242

4343
<programlisting>
4444
CCP_POSIX_TO_WIN_A /* from is char *posix, to is char *win32 */
@@ -62,7 +62,8 @@ default.</para>
6262

6363
<para><parameter>size</parameter> is the size of the buffer pointed to
6464
by <parameter>to</parameter> in bytes. If <parameter>size</parameter>
65-
is 0, <function>cygwin_conv_path</function> just returns the required
65+
is 0, <parameter>to</parameter> may be NULL and
66+
<function>cygwin_conv_path</function> just returns the required
6667
buffer size in bytes. Otherwise, it returns 0 on success, or -1 on
6768
error and errno is set to one of the below values.</para>
6869

@@ -73,6 +74,12 @@ error and errno is set to one of the below values.</para>
7374
of what == CCP_POSIX_TO_WIN_A, longer than MAX_PATH.
7475
ENOSPC size is less than required for the conversion.
7576
</programlisting>
77+
78+
<para>In the event of an error, the memory at <parameter>to</parameter> is
79+
not modified unless the error is <constant>EFAULT</constant> writing to
80+
the memory at <parameter>to</parameter>, which may happen if
81+
<parameter>size</parameter> is incorrectly specified.
82+
7683
</refsect1>
7784

7885
<refsect1 id="func-cygwin-conv-path-example">

0 commit comments

Comments
 (0)