summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2013-10-08 03:10:37 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2013-10-08 03:10:37 +0000
commiteb751ffef735fc1c68b520b064ddc8f8e7992a77 (patch)
treef03d9409d92ec36e5a140f3be70412f85ea5f2dc /bin
parentf667b593b96736b3c6e8a27d0666e25076a756d7 (diff)
POSIX specifies that when the pax input file requests a hardlink
to a symlinks, that it be exactly that and not a hardlink to the file pointed to by the symlink. Use linkat() to get what we want. ok deraadt@
Diffstat (limited to 'bin')
-rw-r--r--bin/pax/file_subs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/pax/file_subs.c b/bin/pax/file_subs.c
index 2b29646943c..43ac002ba1d 100644
--- a/bin/pax/file_subs.c
+++ b/bin/pax/file_subs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file_subs.c,v 1.33 2013/04/16 18:06:35 millert Exp $ */
+/* $OpenBSD: file_subs.c,v 1.34 2013/10/08 03:10:36 guenther Exp $ */
/* $NetBSD: file_subs.c,v 1.4 1995/03/21 09:07:18 cgd Exp $ */
/*-
@@ -307,7 +307,7 @@ mk_link(char *to, struct stat *to_sb, char *from, int ign)
* try again)
*/
for (;;) {
- if (link(to, from) == 0)
+ if (linkat(AT_FDCWD, to, AT_FDCWD, from, 0) == 0)
break;
oerrno = errno;
if (!nodirs && chk_path(from, to_sb->st_uid, to_sb->st_gid) == 0)