poll tests: Avoid test failure on BSD and Solaris systems.
[gnulib.git] / doc / posix-functions / unlink.texi
blob6a29d458a214cd9977d2ee295fbd0ca1b57056a5
1 @node unlink
2 @section @code{unlink}
3 @findex unlink
5 POSIX specification:@* @url{https://pubs.opengroup.org/onlinepubs/9699919799/functions/unlink.html}
7 LSB specification:@* @url{https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/baselib-unlink-3.html}
9 Gnulib module: unlink
11 Portability problems fixed by Gnulib:
12 @itemize
13 @item
14 This function is declared in a different header file (namely, @code{<stdio.h>})
15 on some platforms:
16 MSVC 14.
17 @item
18 Some systems mistakenly succeed on @code{unlink("link-to-file/")}:
19 GNU/Hurd, FreeBSD 7.2, AIX 7.1, Solaris 9.
20 @item
21 On Mac OS X 10.10, in a writable HFS mount, @code{unlink("..")} succeeds
22 without doing anything.
23 @end itemize
25 Portability problems not fixed by Gnulib:
26 @itemize
27 @item
28 Some systems allow a superuser to unlink directories, even though this
29 can cause file system corruption.  The error given if a process is not
30 permitted to unlink directories varies across implementations; it is
31 not always the POSIX value of @code{EPERM}.  Meanwhile, if a process
32 has the ability to unlink directories, POSIX requires that
33 @code{unlink("symlink-to-dir/")} remove @file{dir} and leave
34 @file{symlink-to-dir} dangling; this behavior is counter-intuitive.
35 The gnulib module @code{unlinkdir} can help determine whether code must be
36 cautious of unlinking directories.
37 @item
38 Removing an open file is non-portable: On Unix this allows the programs that
39 have the file already open to continue working with it; the file's storage
40 is only freed when the no process has the file open any more.  On Windows,
41 the attempt to remove an open file fails.
42 @end itemize