Deleted Added
full compact
archive_write_set_format_mtree.c (311041) archive_write_set_format_mtree.c (342360)
1/*-
2 * Copyright (c) 2008 Joerg Sonnenberger
3 * Copyright (c) 2009-2012 Michihiro NAKAJIMA
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include "archive_platform.h"
1/*-
2 * Copyright (c) 2008 Joerg Sonnenberger
3 * Copyright (c) 2009-2012 Michihiro NAKAJIMA
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include "archive_platform.h"
28__FBSDID("$FreeBSD: stable/11/contrib/libarchive/libarchive/archive_write_set_format_mtree.c 311041 2017-01-02 01:41:31Z mm $");
28__FBSDID("$FreeBSD: stable/11/contrib/libarchive/libarchive/archive_write_set_format_mtree.c 342360 2018-12-21 23:33:05Z mm $");
29
30#ifdef HAVE_SYS_TYPES_H
31#include <sys/types.h>
32#endif
33#include <errno.h>
34#include <stdlib.h>
35#include <string.h>
36

--- 1768 unchanged lines hidden (view full) ---

1805 }
1806 if (ll == len)
1807 break;
1808 }
1809 while (*p) {
1810 if (p[0] == '/') {
1811 if (p[1] == '/')
1812 /* Convert '//' --> '/' */
29
30#ifdef HAVE_SYS_TYPES_H
31#include <sys/types.h>
32#endif
33#include <errno.h>
34#include <stdlib.h>
35#include <string.h>
36

--- 1768 unchanged lines hidden (view full) ---

1805 }
1806 if (ll == len)
1807 break;
1808 }
1809 while (*p) {
1810 if (p[0] == '/') {
1811 if (p[1] == '/')
1812 /* Convert '//' --> '/' */
1813 strcpy(p, p+1);
1813 memmove(p, p+1, strlen(p+1) + 1);
1814 else if (p[1] == '.' && p[2] == '/')
1815 /* Convert '/./' --> '/' */
1814 else if (p[1] == '.' && p[2] == '/')
1815 /* Convert '/./' --> '/' */
1816 strcpy(p, p+2);
1816 memmove(p, p+2, strlen(p+2) + 1);
1817 else if (p[1] == '.' && p[2] == '.' && p[3] == '/') {
1818 /* Convert 'dir/dir1/../dir2/'
1819 * --> 'dir/dir2/'
1820 */
1821 char *rp = p -1;
1822 while (rp >= dirname) {
1823 if (*rp == '/')
1824 break;

--- 404 unchanged lines hidden ---
1817 else if (p[1] == '.' && p[2] == '.' && p[3] == '/') {
1818 /* Convert 'dir/dir1/../dir2/'
1819 * --> 'dir/dir2/'
1820 */
1821 char *rp = p -1;
1822 while (rp >= dirname) {
1823 if (*rp == '/')
1824 break;

--- 404 unchanged lines hidden ---