Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Aug 2008 15:38:59 GMT
From:      Anselm Strauss <strauss@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 147305 for review
Message-ID:  <200808131538.m7DFcxxd058365@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=147305

Change 147305 by strauss@strauss_marvelman on 2008/08/13 15:38:30

	Added storing of permissions in external file attributes.

Affected files ...

.. //depot/projects/soc2008/strauss_libarchive/libarchive/archive_write_set_format_zip.c#33 edit

Differences ...

==== //depot/projects/soc2008/strauss_libarchive/libarchive/archive_write_set_format_zip.c#33 (text+ko) ====

@@ -340,22 +340,20 @@
 	struct zip_central_directory_end end;
 	int64_t size;
 	off_t offset_start, offset_end;
-	const char *path;
 	int entries;
 	int ret;
+	mode_t mode;
 	
 	zip = a->format_data;
 	l = zip->central_directory;
 	
 	/*
 	 * Formatting central directory file header fields that are fixed for all entries.
-	 * Fields not used are:
+	 * Fields not used (and therefor 0) are:
 	 * 
-	 *   - flags
-	 *   - extra_length
 	 *   - comment_length
 	 *   - disk_number
-	 *   - attributes_internal, attributes_external
+	 *   - attributes_internal
 	 */
 	memset(&h, 0, sizeof(h));
 	zip_encode(ZIP_SIGNATURE_FILE_HEADER, &h.signature, sizeof(h.signature));
@@ -369,14 +367,16 @@
 		
 		/* Formatting individual header fields per entry. */
 		size = archive_entry_size(l->entry);
-		path = archive_entry_pathname(l->entry);
 		zip_encode(dos_time(archive_entry_mtime(l->entry)), &h.timedate, sizeof(h.timedate));
 		zip_encode(l->crc32, &h.crc32, sizeof(h.crc32));
 		zip_encode(size, &h.compressed_size, sizeof(h.compressed_size));
 		zip_encode(size, &h.uncompressed_size, sizeof(h.uncompressed_size));
 		zip_encode(path_length(l->entry), &h.filename_length, sizeof(h.filename_length));
+		archive_entry_mode(l->entry);
 		h.extra_length[0] = l->extra_length[0];
 		h.extra_length[1] = l->extra_length[1];
+		mode = archive_entry_mode(l->entry);
+		zip_encode(mode, &h.attributes_external[2], sizeof(mode));
 		zip_encode(l->offset, &h.offset, sizeof(h.offset));
 		
 		ret = (a->compressor.write)(a, &h, sizeof(h));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808131538.m7DFcxxd058365>