summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/archive_write.c
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2004-06-27 18:38:13 +0000
committerkientzle <kientzle@FreeBSD.org>2004-06-27 18:38:13 +0000
commit7cfb61a9b9d4d229afc86b347be4b4f696159b61 (patch)
tree028a85142b5dcf820d4a79533ebb325b81e54117 /lib/libarchive/archive_write.c
parent34ed55636f92a39a90a92eadbea5f89e0b642b23 (diff)
downloadFreeBSD-src-7cfb61a9b9d4d229afc86b347be4b4f696159b61.zip
FreeBSD-src-7cfb61a9b9d4d229afc86b347be4b4f696159b61.tar.gz
Clean up some consistent confusion between "dev" and "rdev."
Mostly, these were being used correctly even though a lot of variables and function names were mis-named. In the process, I found and fixed a couple of latent bugs and added a guard against adding an archive to itself.
Diffstat (limited to 'lib/libarchive/archive_write.c')
-rw-r--r--lib/libarchive/archive_write.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/libarchive/archive_write.c b/lib/libarchive/archive_write.c
index 6f872f1..f910f14 100644
--- a/lib/libarchive/archive_write.c
+++ b/lib/libarchive/archive_write.c
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
#include <unistd.h>
#include "archive.h"
+#include "archive_entry.h"
#include "archive_private.h"
extern char **environ;
@@ -186,6 +187,12 @@ archive_write_header(struct archive *a, struct archive_entry *entry)
if (a->state & ARCHIVE_STATE_DATA)
((a->format_finish_entry)(a));
+ if (archive_entry_dev(entry) == a->skip_file_dev &&
+ archive_entry_ino(entry) == a->skip_file_ino) {
+ archive_set_error(a, 0, "Can't add archive to itself.");
+ return (ARCHIVE_WARN);
+ }
+
/* Format and write header. */
ret = ((a->format_write_header)(a, entry));
OpenPOWER on IntegriCloud