unlink, remove: detect FreeBSD bug
[gnulib.git] / doc / posix-functions / unlink.texi
1 @node unlink
2 @section @code{unlink}
3 @findex unlink
4
5 POSIX specification: @url{http://www.opengroup.org/onlinepubs/9699919799/functions/unlink.html}
6
7 Gnulib module: unlink
8
9 Portability problems fixed by Gnulib:
10 @itemize
11 @item
12 Some systems mistakenly succeed on @code{unlink("link-to-file/")}:
13 GNU/Hurd, FreeBSD 7.2, Solaris 9.
14 @end itemize
15
16 Portability problems not fixed by Gnulib:
17 @itemize
18 @item
19 Some systems allow a superuser to unlink directories, even though this
20 can cause file system corruption.  The error given if a process is not
21 permitted to unlink directories varies across implementations; it is
22 not always the POSIX value of @code{EPERM}.  Meanwhile, if a process
23 has the ability to unlink directories, POSIX requires that
24 @code{unlink("symlink-to-dir/")} remove @file{dir} and leave
25 @file{symlink-to-dir} dangling; this behavior is counter-intuitive.
26 The gnulib module unlinkdir can help determine whether code must be
27 cautious of unlinking directories.
28 @item
29 Removing an open file is non-portable: On Unix this allows the programs that
30 have the file already open to continue working with it; the file's storage
31 is only freed when the no process has the file open any more.  On Windows,
32 the attempt to remove an open file fails.
33 @end itemize