archive_write_set_format_ustar.c (303975) | archive_write_set_format_ustar.c (305313) |
---|---|
1/*- 2 * Copyright (c) 2003-2007 Tim Kientzle 3 * Copyright (c) 2011-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) 2003-2007 Tim Kientzle 3 * Copyright (c) 2011-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: releng/11.0/contrib/libarchive/libarchive/archive_write_set_format_ustar.c 238856 2012-07-28 06:38:44Z mm $"); | 28__FBSDID("$FreeBSD: releng/11.0/contrib/libarchive/libarchive/archive_write_set_format_ustar.c 305313 2016-09-03 00:27:41Z mm $"); |
29 30 31#ifdef HAVE_ERRNO_H 32#include <errno.h> 33#endif 34#include <stdio.h> 35#ifdef HAVE_STDLIB_H 36#include <stdlib.h> --- 265 unchanged lines hidden (view full) --- 302 } else 303#endif 304 p = archive_entry_pathname(entry); 305 /* 306 * On Windows, this is a backup operation just in 307 * case getting WCS failed. On POSIX, this is a 308 * normal operation. 309 */ | 29 30 31#ifdef HAVE_ERRNO_H 32#include <errno.h> 33#endif 34#include <stdio.h> 35#ifdef HAVE_STDLIB_H 36#include <stdlib.h> --- 265 unchanged lines hidden (view full) --- 302 } else 303#endif 304 p = archive_entry_pathname(entry); 305 /* 306 * On Windows, this is a backup operation just in 307 * case getting WCS failed. On POSIX, this is a 308 * normal operation. 309 */ |
310 if (p != NULL && p[strlen(p) - 1] != '/') { | 310 if (p != NULL && p[0] != '\0' && p[strlen(p) - 1] != '/') { |
311 struct archive_string as; 312 313 archive_string_init(&as); 314 path_length = strlen(p); 315 if (archive_string_ensure(&as, 316 path_length + 2) == NULL) { 317 archive_set_error(&a->archive, ENOMEM, 318 "Can't allocate ustar data"); --- 446 unchanged lines hidden --- | 311 struct archive_string as; 312 313 archive_string_init(&as); 314 path_length = strlen(p); 315 if (archive_string_ensure(&as, 316 path_length + 2) == NULL) { 317 archive_set_error(&a->archive, ENOMEM, 318 "Can't allocate ustar data"); --- 446 unchanged lines hidden --- |