mirror of
https://git.savannah.gnu.org/git/tar.git
synced 2026-07-08 00:56:47 +00:00
*** empty log message ***
This commit is contained in:
+5
-6
@@ -125,7 +125,7 @@ static int r_error_count;
|
||||
/*
|
||||
* Have we hit EOF yet?
|
||||
*/
|
||||
static int eof;
|
||||
static int hit_eof;
|
||||
|
||||
/* JF we're reading, but we just read the last record and its time to update */
|
||||
extern time_to_start_writing;
|
||||
@@ -153,8 +153,8 @@ static long real_s_sizeleft;
|
||||
void
|
||||
reset_eof()
|
||||
{
|
||||
if(eof) {
|
||||
eof=0;
|
||||
if(hit_eof) {
|
||||
hit_eof=0;
|
||||
ar_record=ar_block;
|
||||
ar_last=ar_block+blocking;
|
||||
ar_reading=0;
|
||||
@@ -170,11 +170,11 @@ union record *
|
||||
findrec()
|
||||
{
|
||||
if (ar_record == ar_last) {
|
||||
if (eof)
|
||||
if (hit_eof)
|
||||
return (union record *)NULL; /* EOF */
|
||||
flush_archive();
|
||||
if (ar_record == ar_last) {
|
||||
eof++;
|
||||
hit_eof++;
|
||||
return (union record *)NULL; /* EOF */
|
||||
}
|
||||
}
|
||||
@@ -546,7 +546,6 @@ open_archive(reading)
|
||||
msg_perror("can't open %s",ar_file);
|
||||
exit(EX_BADARCH);
|
||||
}
|
||||
|
||||
#ifndef __MSDOS__
|
||||
if(!_isrmt(archive)) {
|
||||
struct stat tmp_stat;
|
||||
|
||||
+47
-10
@@ -680,16 +680,53 @@ extract_archive ()
|
||||
skipcrud + current_file_name);
|
||||
}
|
||||
|
||||
if (f_modified)
|
||||
goto set_filestat;
|
||||
tmp = (struct saved_dir_info *) ck_malloc (sizeof (struct saved_dir_info));
|
||||
tmp->path = ck_malloc (strlen (skipcrud + current_file_name) + 1);
|
||||
strcpy (tmp->path, skipcrud + current_file_name);
|
||||
tmp->mode = hstat.st_mode;
|
||||
tmp->atime = hstat.st_atime;
|
||||
tmp->mtime = hstat.st_mtime;
|
||||
tmp->next = saved_dir_info_head;
|
||||
saved_dir_info_head = tmp;
|
||||
/*
|
||||
* If we are root, set the owner and group of the extracted
|
||||
* file. This does what is wanted both on real Unix and on
|
||||
* System V. If we are running as a user, we extract as that
|
||||
* user; if running as root, we extract as the original owner.
|
||||
*/
|
||||
if (we_are_root || f_do_chown)
|
||||
{
|
||||
if (chown (skipcrud + current_file_name,
|
||||
hstat.st_uid, hstat.st_gid) < 0)
|
||||
{
|
||||
msg_perror ("cannot chown file %s to uid %d gid %d",
|
||||
skipcrud + current_file_name,
|
||||
hstat.st_uid, hstat.st_gid);
|
||||
}
|
||||
}
|
||||
|
||||
if (!f_modified)
|
||||
{
|
||||
tmp = ((struct saved_dir_info *)
|
||||
ck_malloc (sizeof (struct saved_dir_info)));
|
||||
tmp->path = (char *) ck_malloc (strlen (skipcrud
|
||||
+ current_file_name) + 1);
|
||||
strcpy (tmp->path, skipcrud + current_file_name);
|
||||
tmp->mode = hstat.st_mode;
|
||||
tmp->atime = hstat.st_atime;
|
||||
tmp->mtime = hstat.st_mtime;
|
||||
tmp->next = saved_dir_info_head;
|
||||
saved_dir_info_head = tmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This functions exactly as the code for set_filestat above. */
|
||||
if ((!f_keep)
|
||||
|| (hstat.st_mode & (S_ISUID | S_ISGID | S_ISVTX)))
|
||||
{
|
||||
if (chmod (skipcrud + current_file_name,
|
||||
notumask & (int) hstat.st_mode) < 0)
|
||||
{
|
||||
msg_perror ("cannot change mode of file %s to %ld",
|
||||
skipcrud + current_file_name,
|
||||
notumask & (int) hstat.st_mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case LF_VOLHDR:
|
||||
if (f_verbose)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user