From 04f4007034005fffa12d6338d44c649351548acc Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 22 Jan 1998 06:21:30 +0000 Subject: Preserve uid/gid if invoked as tar and extracting as root. This is traditional tar behavior. --- bin/pax/options.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'bin/pax') 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': /* -- cgit v1.2.3