diff options
| author | Martin Matuska <mm@FreeBSD.org> | 2020-02-11 23:48:03 +0000 | 
|---|---|---|
| committer | Martin Matuska <mm@FreeBSD.org> | 2020-02-11 23:48:03 +0000 | 
| commit | 8185c4ae244f9a52ad987b36e7d6300500054d00 (patch) | |
| tree | 11e2d7cd0caf20998ed1e1146e1c1d7fc747165e /libarchive/archive_read_disk_posix.c | |
| parent | 98c1f51f769841d99d879099f9075ff60d51ee4a (diff) | |
Diffstat (limited to 'libarchive/archive_read_disk_posix.c')
| -rw-r--r-- | libarchive/archive_read_disk_posix.c | 37 | 
1 files changed, 16 insertions, 21 deletions
| diff --git a/libarchive/archive_read_disk_posix.c b/libarchive/archive_read_disk_posix.c index 183ca1e8790d..52fec7bb42c8 100644 --- a/libarchive/archive_read_disk_posix.c +++ b/libarchive/archive_read_disk_posix.c @@ -729,27 +729,23 @@ _archive_read_data_block(struct archive *_a, const void **buff,  		if ((t->flags & needsRestoreTimes) != 0 &&  		    t->restore_time.noatime == 0)  			flags |= O_NOATIME; -		do {  #endif -			t->entry_fd = open_on_current_dir(t, -			    tree_current_access_path(t), flags); -			__archive_ensure_cloexec_flag(t->entry_fd); +		t->entry_fd = open_on_current_dir(t, +		    tree_current_access_path(t), flags); +		__archive_ensure_cloexec_flag(t->entry_fd);  #if defined(O_NOATIME) -			/* -			 * When we did open the file with O_NOATIME flag, -			 * if successful, set 1 to t->restore_time.noatime -			 * not to restore an atime of the file later. -			 * if failed by EPERM, retry it without O_NOATIME flag. -			 */ -			if (flags & O_NOATIME) { -				if (t->entry_fd >= 0) -					t->restore_time.noatime = 1; -				else if (errno == EPERM) { -					flags &= ~O_NOATIME; -					continue; -				} -			} -		} while (0); +		/* +		 * When we did open the file with O_NOATIME flag, +		 * if successful, set 1 to t->restore_time.noatime +		 * not to restore an atime of the file later. +		 * if failed by EPERM, retry it without O_NOATIME flag. +		 */ +		if (flags & O_NOATIME) { +			if (t->entry_fd >= 0) +				t->restore_time.noatime = 1; +			else if (errno == EPERM) +				flags &= ~O_NOATIME; +		}  #endif  		if (t->entry_fd < 0) {  			archive_set_error(&a->archive, errno, @@ -1110,8 +1106,7 @@ next_entry(struct archive_read_disk *a, struct tree *t,  			    "%s", delayed_str.s);  		}  	} -	if (!archive_string_empty(&delayed_str)) -		archive_string_free(&delayed_str); +	archive_string_free(&delayed_str);  	return (r);  } | 
