svn commit: r302425 - in stable/10/contrib/libarchive: libarchive libarchive/test libarchive_fe
Martin Matuska
mm at FreeBSD.org
Fri Jul 8 10:06:04 UTC 2016
Author: mm
Date: Fri Jul 8 10:06:02 2016
New Revision: 302425
URL: https://svnweb.freebsd.org/changeset/base/302425
Log:
MFC r302294:
Sync libarchive with vendor, bugfixes for tests:
- fix tests on filesystems without birthtime support, e.g. UFS1 (1)
- vendor issue #729: avoid use of C99 for-scope declarations in
test_write_format_gnutar_filenames.c
PR: 204157 (1)
Modified:
stable/10/contrib/libarchive/libarchive/archive_read_disk_posix.c
stable/10/contrib/libarchive/libarchive/archive_string.c
stable/10/contrib/libarchive/libarchive/archive_write_disk_posix.c
stable/10/contrib/libarchive/libarchive/test/main.c
stable/10/contrib/libarchive/libarchive/test/test_write_format_gnutar_filenames.c
stable/10/contrib/libarchive/libarchive_fe/passphrase.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/contrib/libarchive/libarchive/archive_read_disk_posix.c
==============================================================================
--- stable/10/contrib/libarchive/libarchive/archive_read_disk_posix.c Fri Jul 8 04:34:13 2016 (r302424)
+++ stable/10/contrib/libarchive/libarchive/archive_read_disk_posix.c Fri Jul 8 10:06:02 2016 (r302425)
@@ -1504,7 +1504,11 @@ setup_current_filesystem(struct archive_
struct tree *t = a->tree;
struct statfs sfs;
#if defined(HAVE_GETVFSBYNAME) && defined(VFCF_SYNTHETIC)
+# if defined(HAVE_STRUCT_VFSCONF)
+ struct vfsconf vfc;
+# else
struct xvfsconf vfc;
+# endif
#endif
int r, xr = 0;
#if !defined(HAVE_STRUCT_STATFS_F_NAMEMAX)
Modified: stable/10/contrib/libarchive/libarchive/archive_string.c
==============================================================================
--- stable/10/contrib/libarchive/libarchive/archive_string.c Fri Jul 8 04:34:13 2016 (r302424)
+++ stable/10/contrib/libarchive/libarchive/archive_string.c Fri Jul 8 10:06:02 2016 (r302425)
@@ -559,7 +559,8 @@ archive_wstring_append_from_mbs_in_codep
}
if (count == 0 && length != 0)
ret = -1;
- } while (0);
+ break;
+ } while (1);
}
dest->length += count;
dest->s[dest->length] = L'\0';
@@ -3552,18 +3553,19 @@ win_strncat_from_utf16(struct archive_st
ll = WideCharToMultiByte(sc->to_cp, 0,
(LPCWSTR)u16, (int)bytes>>1, mbs, (int)mbs_size,
NULL, &defchar);
- if (ll == 0 &&
- GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
- /* Need more buffer for MBS. */
- ll = WideCharToMultiByte(sc->to_cp, 0,
- (LPCWSTR)u16, (int)bytes, NULL, 0, NULL, NULL);
- if (archive_string_ensure(as, ll +1) == NULL)
- return (-1);
- mbs = as->s + as->length;
- mbs_size = as->buffer_length - as->length -1;
- continue;
+ /* Exit loop if we succeeded */
+ if (ll != 0 ||
+ GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
+ break;
}
- } while (0);
+ /* Else expand buffer and loop to try again. */
+ ll = WideCharToMultiByte(sc->to_cp, 0,
+ (LPCWSTR)u16, (int)bytes, NULL, 0, NULL, NULL);
+ if (archive_string_ensure(as, ll +1) == NULL)
+ return (-1);
+ mbs = as->s + as->length;
+ mbs_size = as->buffer_length - as->length -1;
+ } while (1);
archive_string_free(&tmp);
as->length += ll;
as->s[as->length] = '\0';
@@ -3634,19 +3636,20 @@ win_strncat_to_utf16(struct archive_stri
do {
count = MultiByteToWideChar(sc->from_cp,
MB_PRECOMPOSED, s, (int)length, (LPWSTR)u16, (int)avail>>1);
- if (count == 0 &&
- GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
- /* Need more buffer for UTF-16 string */
- count = MultiByteToWideChar(sc->from_cp,
- MB_PRECOMPOSED, s, (int)length, NULL, 0);
- if (archive_string_ensure(as16, (count +1) * 2)
- == NULL)
- return (-1);
- u16 = as16->s + as16->length;
- avail = as16->buffer_length - 2;
- continue;
+ /* Exit loop if we succeeded */
+ if (count != 0 ||
+ GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
+ break;
}
- } while (0);
+ /* Expand buffer and try again */
+ count = MultiByteToWideChar(sc->from_cp,
+ MB_PRECOMPOSED, s, (int)length, NULL, 0);
+ if (archive_string_ensure(as16, (count +1) * 2)
+ == NULL)
+ return (-1);
+ u16 = as16->s + as16->length;
+ avail = as16->buffer_length - 2;
+ } while (1);
as16->length += count * 2;
as16->s[as16->length] = 0;
as16->s[as16->length+1] = 0;
Modified: stable/10/contrib/libarchive/libarchive/archive_write_disk_posix.c
==============================================================================
--- stable/10/contrib/libarchive/libarchive/archive_write_disk_posix.c Fri Jul 8 04:34:13 2016 (r302424)
+++ stable/10/contrib/libarchive/libarchive/archive_write_disk_posix.c Fri Jul 8 10:06:02 2016 (r302425)
@@ -3487,6 +3487,9 @@ exit_xattr:
static int
copy_acls(struct archive_write_disk *a, int tmpfd, int dffd)
{
+#ifndef HAVE_SYS_ACL_H
+ return 0;
+#else
acl_t acl, dfacl = NULL;
int acl_r, ret = ARCHIVE_OK;
@@ -3514,6 +3517,7 @@ exit_acl:
if (dfacl)
acl_free(dfacl);
return (ret);
+#endif
}
static int
Modified: stable/10/contrib/libarchive/libarchive/test/main.c
==============================================================================
--- stable/10/contrib/libarchive/libarchive/test/main.c Fri Jul 8 04:34:13 2016 (r302424)
+++ stable/10/contrib/libarchive/libarchive/test/main.c Fri Jul 8 10:06:02 2016 (r302425)
@@ -1292,6 +1292,11 @@ assertion_file_time(const char *file, in
switch (type) {
case 'a': filet_nsec = st.st_atimespec.tv_nsec; break;
case 'b': filet = st.st_birthtime;
+ /* FreeBSD filesystems that don't support birthtime
+ * (e.g., UFS1) always return -1 here. */
+ if (filet == -1) {
+ return (1);
+ }
filet_nsec = st.st_birthtimespec.tv_nsec; break;
case 'm': filet_nsec = st.st_mtimespec.tv_nsec; break;
default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type);
Modified: stable/10/contrib/libarchive/libarchive/test/test_write_format_gnutar_filenames.c
==============================================================================
--- stable/10/contrib/libarchive/libarchive/test/test_write_format_gnutar_filenames.c Fri Jul 8 04:34:13 2016 (r302424)
+++ stable/10/contrib/libarchive/libarchive/test/test_write_format_gnutar_filenames.c Fri Jul 8 10:06:02 2016 (r302425)
@@ -42,6 +42,7 @@ DEFINE_TEST(test_write_format_gnutar_fil
struct archive_entry *ae, *template;
struct archive *a;
size_t used;
+ int i;
buff = malloc(buffsize); /* million bytes of work area */
assert(buff != NULL);
@@ -55,7 +56,7 @@ DEFINE_TEST(test_write_format_gnutar_fil
archive_entry_set_mode(template, S_IFREG | 0755);
archive_entry_set_size(template, 8);
- for (int i = 0; i < 2000; ++i) {
+ for (i = 0; i < 2000; ++i) {
filename[i] = 'a';
filename[i + 1] = '\0';
archive_entry_copy_pathname(template, filename);
@@ -97,6 +98,7 @@ DEFINE_TEST(test_write_format_gnutar_lin
struct archive_entry *ae, *template;
struct archive *a;
size_t used;
+ int i;
buff = malloc(buffsize); /* million bytes of work area */
assert(buff != NULL);
@@ -110,7 +112,7 @@ DEFINE_TEST(test_write_format_gnutar_lin
archive_entry_set_mode(template, S_IFLNK | 0755);
archive_entry_copy_pathname(template, "link");
- for (int i = 0; i < 2000; ++i) {
+ for (i = 0; i < 2000; ++i) {
filename[i] = 'a';
filename[i + 1] = '\0';
archive_entry_copy_symlink(template, filename);
Modified: stable/10/contrib/libarchive/libarchive_fe/passphrase.c
==============================================================================
--- stable/10/contrib/libarchive/libarchive_fe/passphrase.c Fri Jul 8 04:34:13 2016 (r302424)
+++ stable/10/contrib/libarchive/libarchive_fe/passphrase.c Fri Jul 8 10:06:02 2016 (r302425)
@@ -132,6 +132,10 @@ readpassphrase(const char *prompt, char
#include <termios.h>
#include <unistd.h>
+#ifndef _PATH_TTY
+#define _PATH_TTY "/dev/tty"
+#endif
+
#ifdef TCSASOFT
# define _T_FLUSH (TCSAFLUSH|TCSASOFT)
#else
More information about the svn-src-stable-10
mailing list