Noted discrepancy between Linux and POSIX.1 when oldpath is a symbolic

link.
This commit is contained in:
Michael Kerrisk 2005-04-04 16:54:25 +00:00
parent 3d9a2200a6
commit 490df3ae03
1 changed files with 22 additions and 1 deletions

View File

@ -48,7 +48,7 @@ be overwritten.
This new name may be used exactly as the old one for any operation;
both names refer to the same file (and so have the same permissions
and ownership) and it is impossible to tell which name was the
`original'.
\`original'.
.SH "RETURN VALUE"
On success, zero is returned. On error, \-1 is returned, and
.I errno
@ -130,6 +130,27 @@ Hard links, as created by
cannot span filesystems. Use
.B symlink
if this is required.
POSIX.1-2001 says that
.BR link
should dereference
.I oldpath
if it is a symbolic link.
However, Linux does not do so: if
.I oldpath
is a symbolic link, then
.I newpath
is created as a (hard) link to the same symbolic link file
(i.e.,
.I newpath
becomes a symbolic link to the same file that
.I oldpath
refers to).
Some other implementations behave in the same manner as Linux.
.\" For example, the default Solaris compilation environment
.\" behaves like Linux, and contributors to a March 2005
.\" thread in the Austin mailing list reported that some
.\" other (SysV) implementations did/do the same -- MTK, Apr 05
.SH "CONFORMING TO"
SVr4, SVID, POSIX, BSD 4.3, X/OPEN. SVr4 documents additional ENOLINK and
EMULTIHOP error conditions; POSIX.1 does not document ELOOP.