summaryrefslogtreecommitdiffstats
path: root/usr.bin/tar/write.c
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2007-03-11 10:36:42 +0000
committerkientzle <kientzle@FreeBSD.org>2007-03-11 10:36:42 +0000
commit7cd084865b2e1c7ad98900613cd9638fac8b1da9 (patch)
treeb253bcb01fbf32db2a44b3fe008a210506f826c8 /usr.bin/tar/write.c
parentc533ace5debb7bd4b941d9cb5ab620dc140cf83f (diff)
downloadFreeBSD-src-7cd084865b2e1c7ad98900613cd9638fac8b1da9.zip
FreeBSD-src-7cd084865b2e1c7ad98900613cd9638fac8b1da9.tar.gz
bsdtar 2.0.23:
* New test scripts exercise some basic functionality * Most header inclusions are now protected (portability) * read.c now relies on security checks in libarchive instead of trying to do its own (optimization) * -p now enabled by default for root, add --no-same-permissions to disable it * Comments, minor style fixes.
Diffstat (limited to 'usr.bin/tar/write.c')
-rw-r--r--usr.bin/tar/write.c47
1 files changed, 37 insertions, 10 deletions
diff --git a/usr.bin/tar/write.c b/usr.bin/tar/write.c
index 255074c..d83dcc1 100644
--- a/usr.bin/tar/write.c
+++ b/usr.bin/tar/write.c
@@ -26,27 +26,57 @@
#include "bsdtar_platform.h"
__FBSDID("$FreeBSD$");
-#include <sys/stat.h>
+#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
-#ifdef HAVE_POSIX_ACL
+#endif
+#ifdef HAVE_SYS_ACL_H
#include <sys/acl.h>
#endif
+#ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
#ifdef HAVE_ATTR_XATTR_H
#include <attr/xattr.h>
#endif
+#ifdef HAVE_ERRNO_H
#include <errno.h>
+#endif
+#ifdef HAVE_EXT2FS_EXT2_FS_H
+#include <ext2fs/ext2_fs.h>
+#endif
+#ifdef HAVE_FCNTL_H
#include <fcntl.h>
+#endif
+#ifdef HAVE_FNMATCH_H
#include <fnmatch.h>
+#endif
+#ifdef HAVE_GRP_H
#include <grp.h>
+#endif
+#ifdef HAVE_LIMITS_H
#include <limits.h>
+#endif
+#ifdef HAVE_LINUX_FS_H
+#include <linux/fs.h> /* for Linux file flags */
+#endif
+#ifdef HAVE_LINUX_EXT2_FS_H
+#include <linux/ext2_fs.h> /* for Linux file flags */
+#endif
+#ifdef HAVE_PWD_H
#include <pwd.h>
+#endif
#include <stdio.h>
+#ifdef HAVE_STDLIB_H
#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
#include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
-#ifdef __linux
-#include <ext2fs/ext2_fs.h>
-#include <sys/ioctl.h>
#endif
#include "bsdtar.h"
@@ -820,7 +850,7 @@ write_entry(struct bsdtar *bsdtar, struct archive *a, const struct stat *st,
* to inform us that the archive body won't get stored. In
* that case, just skip the write.
*/
- if (fd >= 0 && archive_entry_size(entry) > 0)
+ if (e >= ARCHIVE_WARN && fd >= 0 && archive_entry_size(entry) > 0)
if (write_file_data(bsdtar, a, fd))
exit(1);
@@ -1395,7 +1425,7 @@ new_enough(struct bsdtar *bsdtar, const char *path, const struct stat *st)
if (bsdtar->archive_dir != NULL &&
bsdtar->archive_dir->head != NULL) {
for (p = bsdtar->archive_dir->head; p != NULL; p = p->next) {
- if (strcmp(path, p->name)==0)
+ if (pathcmp(path, p->name)==0)
return (p->mtime_sec < st->st_mtime ||
(p->mtime_sec == st->st_mtime &&
p->mtime_nsec
@@ -1418,9 +1448,6 @@ add_dir_list(struct bsdtar *bsdtar, const char *path,
{
struct archive_dir_entry *p;
- if (path[0] == '.' && path[1] == '/' && path[2] != '\0')
- path += 2;
-
/*
* Search entire list to see if this file has appeared before.
* If it has, override the timestamp data.
OpenPOWER on IntegriCloud