annotate doc/posix-functions/fopen.texi @ 10472:a4dc39a18d54

Ensure that a filename ending in a slash cannot be used to access a non-directory.
author Bruno Haible <bruno@clisp.org>
date Wed, 24 Sep 2008 13:50:02 +0200
parents 76082cdf54ba
children 541a421c693f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9638
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 @node fopen
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2 @section @code{fopen}
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 @findex fopen
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 POSIX specification: @url{http://www.opengroup.org/susv3xsh/fopen.html}
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 Gnulib module: fopen
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 Portability problems fixed by Gnulib:
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 @itemize
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 @item
10376
8532ecccedda Work around bug with trailing slash on Solaris 9 and HP-UX 11.00.
Bruno Haible <bruno@clisp.org>
parents: 9638
diff changeset
12 This function does not fail when the file name argument ends in a slash
10472
a4dc39a18d54 Ensure that a filename ending in a slash cannot be used to access a non-directory.
Bruno Haible <bruno@clisp.org>
parents: 10468
diff changeset
13 and (without the slash) names a nonexistent file or a file that is not a
a4dc39a18d54 Ensure that a filename ending in a slash cannot be used to access a non-directory.
Bruno Haible <bruno@clisp.org>
parents: 10468
diff changeset
14 directory, on some platforms:
10376
8532ecccedda Work around bug with trailing slash on Solaris 9 and HP-UX 11.00.
Bruno Haible <bruno@clisp.org>
parents: 9638
diff changeset
15 HP-UX 11.00, Solaris 9.
8532ecccedda Work around bug with trailing slash on Solaris 9 and HP-UX 11.00.
Bruno Haible <bruno@clisp.org>
parents: 9638
diff changeset
16 @item
9638
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17 On Windows platforms (excluding Cygwin), this function does usually not
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 recognize the @file{/dev/null} filename.
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 @end itemize
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 Portability problems not fixed by Gnulib:
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 @itemize
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 @item
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 On Windows platforms (excluding Cygwin), this function does not set @code{errno}
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 upon failure.
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 @item
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 On Windows, this function returns a file stream in ``text'' mode by default;
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 this means that it translates @code{'\n'} to CR/LF by default. Use the
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 @code{"b"} flag if you need reliable binary I/O.
10468
76082cdf54ba fopen: document mingw bug on directories
Eric Blake <ebb9@byu.net>
parents: 10376
diff changeset
30 @item
76082cdf54ba fopen: document mingw bug on directories
Eric Blake <ebb9@byu.net>
parents: 10376
diff changeset
31 On Windows platforms (excluding Cygwin), this function fails to open
76082cdf54ba fopen: document mingw bug on directories
Eric Blake <ebb9@byu.net>
parents: 10376
diff changeset
32 directories for reading. Such streams have implementation-defined
76082cdf54ba fopen: document mingw bug on directories
Eric Blake <ebb9@byu.net>
parents: 10376
diff changeset
33 semantics on other platforms. To avoid directory streams with a
76082cdf54ba fopen: document mingw bug on directories
Eric Blake <ebb9@byu.net>
parents: 10376
diff changeset
34 consistent error message, use @code{fstat} after @code{open} and
76082cdf54ba fopen: document mingw bug on directories
Eric Blake <ebb9@byu.net>
parents: 10376
diff changeset
35 @code{fdopen}, rather than @code{fopen} and @code{fileno}.
9638
070329237839 Rename two directories: headers -> posix-headers, functions -> posix-functions.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 @end itemize