Next: unlinkat
, Previous: ungetwc
, Up: ISO C and POSIX Function Substitutes [Contents][Index]
unlink
POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/unlink.html
LSB specification:
https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/baselib-unlink-3.html
Gnulib module: unlink
Portability problems fixed by Gnulib:
<stdio.h>
)
on some platforms:
MSVC 14.
unlink("link-to-file/")
:
GNU/Hurd, FreeBSD 7.2, AIX 7.1, Solaris 9.
unlink("..")
succeeds
without doing anything.
Portability problems not fixed by Gnulib:
EPERM
. Meanwhile, if a process
has the ability to unlink directories, POSIX requires that
unlink("symlink-to-dir/")
remove dir and leave
symlink-to-dir dangling; this behavior is counter-intuitive.
The gnulib module unlinkdir
can help determine whether code must be
cautious of unlinking directories.