summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-01-22 06:21:30 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-01-22 06:21:30 +0000
commit04f4007034005fffa12d6338d44c649351548acc (patch)
tree26e0687f1e8af4915b27142a4057f6a7966b4d8d /bin
parent489b43b8f0423bca982ab603f05c8b92a6758fa2 (diff)
Preserve uid/gid if invoked as tar and extracting as root.
This is traditional tar behavior.
Diffstat (limited to 'bin')
-rw-r--r--bin/pax/options.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/bin/pax/options.c b/bin/pax/options.c
index fc378c84c02..7b2ea216f6e 100644
--- a/bin/pax/options.c
+++ b/bin/pax/options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options.c,v 1.30 1997/09/01 18:29:54 deraadt Exp $ */
+/* $OpenBSD: options.c,v 1.31 1998/01/22 06:21:29 millert Exp $ */
/* $NetBSD: options.c,v 1.6 1996/03/26 23:54:18 mrg Exp $ */
/*-
@@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 4/18/94";
#else
-static char rcsid[] = "$OpenBSD: options.c,v 1.30 1997/09/01 18:29:54 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: options.c,v 1.31 1998/01/22 06:21:29 millert Exp $";
#endif
#endif /* not lint */
@@ -716,9 +716,11 @@ tar_options(argc, argv)
break;
case 'x':
/*
- * write an archive
+ * write an archive, preserve ids if root
*/
act = EXTRACT;
+ if (geteuid() == 0)
+ pids = 1;
break;
case 'z':
/*