diff options
author | kientzle <kientzle@FreeBSD.org> | 2004-06-27 18:38:13 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2004-06-27 18:38:13 +0000 |
commit | 7cfb61a9b9d4d229afc86b347be4b4f696159b61 (patch) | |
tree | 028a85142b5dcf820d4a79533ebb325b81e54117 /lib/libarchive/archive_write_set_format_pax.c | |
parent | 34ed55636f92a39a90a92eadbea5f89e0b642b23 (diff) | |
download | FreeBSD-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_set_format_pax.c')
-rw-r--r-- | lib/libarchive/archive_write_set_format_pax.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/lib/libarchive/archive_write_set_format_pax.c b/lib/libarchive/archive_write_set_format_pax.c index 950cd4d..937113a 100644 --- a/lib/libarchive/archive_write_set_format_pax.c +++ b/lib/libarchive/archive_write_set_format_pax.c @@ -446,26 +446,28 @@ archive_write_pax_header(struct archive *a, /* * POSIX/SUSv3 doesn't provide a standard key for large device - * numbers. I use the same keys here that Joerg Schilling used for - * 'star.' No doubt, other implementations use other keys. Note that - * there's no reason we can't write the same information into a number - * of different keys. + * numbers. I use the same keys here that Joerg Schilling + * used for 'star.' (Which, somewhat confusingly, are called + * "devXXX" even though they code "rdev" values.) No doubt, + * other implementations use other keys. Note that there's no + * reason we can't write the same information into a number of + * different keys. * * Of course, this is only needed for block or char device entries. */ if (S_ISBLK(st_main->st_mode) || S_ISCHR(st_main->st_mode)) { /* - * If devmajor is too large, add 'SCHILY.devmajor' to + * If rdevmajor is too large, add 'SCHILY.devmajor' to * extended attributes. */ - dev_t devmajor, devminor; - devmajor = major(st_main->st_rdev); - devminor = minor(st_main->st_rdev); - if (devmajor >= (1 << 18)) { + dev_t rdevmajor, rdevminor; + rdevmajor = major(st_main->st_rdev); + rdevminor = minor(st_main->st_rdev); + if (rdevmajor >= (1 << 18)) { add_pax_attr_int(&(pax->pax_header), "SCHILY.devmajor", - devmajor); - archive_entry_set_devmajor(entry_main, (1 << 18) - 1); + rdevmajor); + archive_entry_set_rdevmajor(entry_main, (1 << 18) - 1); need_extension = 1; } @@ -473,10 +475,10 @@ archive_write_pax_header(struct archive *a, * If devminor is too large, add 'SCHILY.devminor' to * extended attributes. */ - if (devminor >= (1 << 18)) { + if (rdevminor >= (1 << 18)) { add_pax_attr_int(&(pax->pax_header), "SCHILY.devminor", - devminor); - archive_entry_set_devminor(entry_main, (1 << 18) - 1); + rdevminor); + archive_entry_set_rdevminor(entry_main, (1 << 18) - 1); need_extension = 1; } } @@ -558,6 +560,8 @@ archive_write_pax_header(struct archive *a, "SCHILY.acl.default", wp); /* Include star-compatible metadata info. */ + /* Note: "SCHILY.dev{major,minor}" are NOT the + * major/minor portions of "SCHILY.dev". */ add_pax_attr_int(&(pax->pax_header), "SCHILY.dev", st_main->st_dev); add_pax_attr_int(&(pax->pax_header), "SCHILY.ino", |