diff options
author | kientzle <kientzle@FreeBSD.org> | 2009-03-07 02:58:15 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2009-03-07 02:58:15 +0000 |
commit | 1047af1f550ec2c3f4d3edc964dffd5fb2a088f7 (patch) | |
tree | 397d4daf6db2a5ec96f20436a0dede781f8882ff | |
parent | d60e57a219eff89b891ff20ee2f72fe1a63b7da2 (diff) | |
download | FreeBSD-src-1047af1f550ec2c3f4d3edc964dffd5fb2a088f7.zip FreeBSD-src-1047af1f550ec2c3f4d3edc964dffd5fb2a088f7.tar.gz |
Merge r511,r513,r607 from libarchive.googlecode.com: Mtree reader
tweaks: Support nanosecond timestamps, handle attributes broken
across multiple lines.
-rw-r--r-- | lib/libarchive/archive_read_support_format_mtree.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/lib/libarchive/archive_read_support_format_mtree.c b/lib/libarchive/archive_read_support_format_mtree.c index 309ab25..3a58620 100644 --- a/lib/libarchive/archive_read_support_format_mtree.c +++ b/lib/libarchive/archive_read_support_format_mtree.c @@ -891,8 +891,17 @@ parse_keyword(struct archive_read *a, struct mtree *mtree, break; } if (strcmp(key, "time") == 0) { + time_t m; + long ns; + *parsed_kws |= MTREE_HAS_MTIME; - archive_entry_set_mtime(entry, mtree_atol10(&val), 0); + m = (time_t)mtree_atol10(&val); + if (*val == '.') { + ++val; + ns = (long)mtree_atol10(&val); + } else + ns = 0; + archive_entry_set_mtime(entry, m, ns); break; } if (strcmp(key, "type") == 0) { @@ -1225,6 +1234,7 @@ readline(struct archive_read *a, struct mtree *mtree, char **start, ssize_t limi { ssize_t bytes_read; ssize_t total_size = 0; + ssize_t find_off = 0; const void *t; const char *s; void *p; @@ -1262,9 +1272,7 @@ readline(struct archive_read *a, struct mtree *mtree, char **start, ssize_t limi /* Null terminate. */ mtree->line.s[total_size] = '\0'; /* If we found an unescaped '\n', clean up and return. */ - if (p == NULL) - continue; - for (u = mtree->line.s; *u; ++u) { + for (u = mtree->line.s + find_off; *u; ++u) { if (u[0] == '\n') { *start = mtree->line.s; return total_size; @@ -1285,8 +1293,12 @@ readline(struct archive_read *a, struct mtree *mtree, char **start, ssize_t limi memmove(u, u + 1, total_size - (u - mtree->line.s) + 1); --total_size; - continue; + ++u; + break; } + if (u[1] == '\0') + break; } + find_off = u - mtree->line.s; } } |