summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/archive_write_set_format_ustar.c
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2004-03-09 19:50:41 +0000
committerkientzle <kientzle@FreeBSD.org>2004-03-09 19:50:41 +0000
commit90072dfae070d180d3c16e0f229fb392b4b910b5 (patch)
treecdb30a1bca796a2ba7a0c712682c923cc981d32c /lib/libarchive/archive_write_set_format_ustar.c
parent63f793ca249823f0c3812457a8342dd6702d0548 (diff)
downloadFreeBSD-src-90072dfae070d180d3c16e0f229fb392b4b910b5.zip
FreeBSD-src-90072dfae070d180d3c16e0f229fb392b4b910b5.tar.gz
Many fixes.
Portability: Thanks to Juergen Lock, libarchive now compiles cleanly on Linux. Along the way, I cleaned up a lot of error return codes and reorganized some code to simplify conditional compilation of certain sections. Bug fixes: * pax format now actually stores filenames that are 101-154 characters long. * pax format now allows newline characters in extended attributes (this fixes a long-standing bug in ACL handling) * mtime/atime are now restored for directories * directory list is now sorted prior to fix-up to permit correct restore of non-writable dir heirarchies
Diffstat (limited to 'lib/libarchive/archive_write_set_format_ustar.c')
-rw-r--r--lib/libarchive/archive_write_set_format_ustar.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/libarchive/archive_write_set_format_ustar.c b/lib/libarchive/archive_write_set_format_ustar.c
index 649be5e..5e29478 100644
--- a/lib/libarchive/archive_write_set_format_ustar.c
+++ b/lib/libarchive/archive_write_set_format_ustar.c
@@ -24,11 +24,11 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include "archive_platform.h"
__FBSDID("$FreeBSD$");
#include <sys/stat.h>
-#ifdef DMALLOC
+#ifdef HAVE_DMALLOC
#include <dmalloc.h>
#endif
#include <errno.h>
@@ -183,10 +183,12 @@ __archive_write_format_header_ustar(struct archive *a, char buff[512],
* remaining name are too large, return an error.
*/
if (!p) {
- archive_set_error(a, -1, "Pathname too long");
+ archive_set_error(a, ENAMETOOLONG,
+ "Pathname too long");
ret = ARCHIVE_WARN;
} else if (p > pp + sizeof(h->prefix)) {
- archive_set_error(a, -1, "Pathname too long");
+ archive_set_error(a, ENAMETOOLONG,
+ "Pathname too long");
ret = ARCHIVE_WARN;
} else {
/* Copy prefix and remainder to appropriate places */
@@ -200,7 +202,8 @@ __archive_write_format_header_ustar(struct archive *a, char buff[512],
p = archive_entry_symlink(entry);
if (p != NULL && p[0] != '\0') {
if (strlen(p) > sizeof(h->linkname)) {
- archive_set_error(a, -1, "Link contents too long");
+ archive_set_error(a, ENAMETOOLONG,
+ "Link contents too long");
ret = ARCHIVE_WARN;
} else
memcpy(h->linkname, p, strlen(p));
@@ -209,7 +212,8 @@ __archive_write_format_header_ustar(struct archive *a, char buff[512],
p = archive_entry_uname(entry);
if (p != NULL && p[0] != '\0') {
if (strlen(p) > sizeof(h->uname)) {
- archive_set_error(a, -1, "Username too long");
+ archive_set_error(a, ARCHIVE_ERRNO_MISC,
+ "Username too long");
ret = ARCHIVE_WARN;
} else
memcpy(h->uname, p, strlen(p));
@@ -218,7 +222,8 @@ __archive_write_format_header_ustar(struct archive *a, char buff[512],
p = archive_entry_gname(entry);
if (p != NULL && p[0] != '\0') {
if (strlen(p) > sizeof(h->gname)) {
- archive_set_error(a, -1, "Group name too long");
+ archive_set_error(a, ARCHIVE_ERRNO_MISC,
+ "Group name too long");
ret = ARCHIVE_WARN;
} else
memcpy(h->gname, p, strlen(p));
@@ -291,12 +296,12 @@ __archive_write_format_header_ustar(struct archive *a, char buff[512],
case S_IFDIR: h->typeflag[0] = '5' ; break;
case S_IFIFO: h->typeflag[0] = '6' ; break;
case S_IFSOCK:
- archive_set_error(a, -1,
+ archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT,
"tar format cannot archive socket");
ret = ARCHIVE_WARN;
break;
default:
- archive_set_error(a, -1,
+ archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT,
"tar format cannot archive this");
ret = ARCHIVE_WARN;
}
OpenPOWER on IntegriCloud