>From ea69905b614ad97d9705e764fdbec01ddbc39f70 Mon Sep 17 00:00:00 2001
From: Petr Sumbera
Date: Tue, 10 Aug 2010 16:03:45 +0200
Subject: child process may want to have linkdir privilege restored
---
src/extract.c | 3 ---
src/system.c | 8 ++++++++
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/extract.c b/src/extract.c
index 9897e82..886c8da 100644
--- a/src/extract.c
+++ b/src/extract.c
@@ -1271,9 +1271,6 @@ extract_archive (void)
fatal_exit_hook = extract_finish;
- /* Try to disable the ability to unlink a directory. */
- priv_set_remove_linkdir ();
-
set_next_block_after (current_header);
if (!current_stat_info.file_name[0]
diff --git a/src/system.c b/src/system.c
index 345cc07..fcb7949 100644
--- a/src/system.c
+++ b/src/system.c
@@ -20,6 +20,7 @@
#include
#include "common.h"
+#include
#include
#include
@@ -695,6 +696,8 @@ sys_exec_command (char *file_name, int typechar, struct tar_stat_info *st)
xdup2 (p[PREAD], STDIN_FILENO);
xclose (p[PWRITE]);
+ priv_set_restore_linkdir();
+
stat_to_env (file_name, typechar, st);
argv[0] = "/bin/sh";
@@ -811,6 +814,8 @@ sys_exec_info_script (const char **archive_name, int volume_number)
xclose (p[PREAD]);
+ priv_set_restore_linkdir();
+
argv[0] = "/bin/sh";
argv[1] = "-c";
argv[2] = (char *) info_script_option;
@@ -858,6 +863,9 @@ sys_exec_checkpoint_script (const char *script_name,
setenv ("TAR_FORMAT",
archive_format_string (current_format == DEFAULT_FORMAT ?
archive_format : current_format), 1);
+
+ priv_set_restore_linkdir();
+
argv[0] = "/bin/sh";
argv[1] = "-c";
argv[2] = (char *) script_name;
--
1.5.6.5