* gnulib.modules: Add priv-set.
* src/extract.c (set_mode, extract_archive): Restore
PRIV_SYS_LINKDIR on chmod failure.
* src/tar.c (main): Drop PRIV_SYS_LINKDIR on startup.
mkdtemp
modechange
obstack
mkdtemp
modechange
obstack
#include <utimens.h>
#include <errno.h>
#include <xgetcwd.h>
#include <utimens.h>
#include <errno.h>
#include <xgetcwd.h>
char typeflag)
{
mode_t mode;
char typeflag)
{
mode_t mode;
if (0 < same_permissions_option
&& permstatus != INTERDIR_PERMSTATUS)
{
if (0 < same_permissions_option
&& permstatus != INTERDIR_PERMSTATUS)
{
mode = cur_info->st_mode ^ invert_permissions;
}
mode = cur_info->st_mode ^ invert_permissions;
}
- if (chmod (file_name, mode) != 0)
+ failed = chmod (file_name, mode) != 0;
+ if (failed && errno == EPERM)
+ {
+ /* On Solaris, chmod may fail if we don't have PRIV_ALL. */
+ if (priv_set_restore_linkdir () == 0)
+ {
+ failed = chmod (file_name, mode) != 0;
+ priv_set_remove_linkdir ();
+ }
+ }
+ if (failed)
chmod_error_details (file_name, mode);
}
chmod_error_details (file_name, mode);
}
char typeflag;
tar_extractor_t fun;
char typeflag;
tar_extractor_t fun;
+ /* Try to disable the ability to unlink a directory. */
+ priv_set_remove_linkdir ();
+
set_next_block_after (current_header);
decode_header (current_header, ¤t_stat_info, ¤t_format, 1);
if (!current_stat_info.file_name[0]
set_next_block_after (current_header);
decode_header (current_header, ¤t_stat_info, ¤t_format, 1);
if (!current_stat_info.file_name[0]
#include <version-etc.h>
#include <xstrtol.h>
#include <stdopen.h>
#include <version-etc.h>
#include <xstrtol.h>
#include <stdopen.h>
/* Local declarations. */
/* Local declarations. */
/* System V fork+wait does not work if SIGCHLD is ignored. */
signal (SIGCHLD, SIG_DFL);
/* System V fork+wait does not work if SIGCHLD is ignored. */
signal (SIGCHLD, SIG_DFL);
+ /* Try to disable the ability to unlink a directory. */
+ priv_set_remove_linkdir ();
+
/* Decode options. */
decode_options (argc, argv);
/* Decode options. */
decode_options (argc, argv);