diff options
author | Marius Strobl <marius@FreeBSD.org> | 2011-08-10 19:12:21 +0000 |
---|---|---|
committer | Marius Strobl <marius@FreeBSD.org> | 2011-08-10 19:12:21 +0000 |
commit | 852f933d9d31a633ae416f0c1e020c5c01a4e9cd (patch) | |
tree | 6523aec50aaa1496802d456fb2481464a0719587 /usr.sbin/makefs | |
parent | 1bf5a6cf3ce807b20dd2e360e2041078d4ace0e5 (diff) | |
download | src-test2-852f933d9d31a633ae416f0c1e020c5c01a4e9cd.tar.gz src-test2-852f933d9d31a633ae416f0c1e020c5c01a4e9cd.zip |
Notes
Diffstat (limited to 'usr.sbin/makefs')
-rw-r--r-- | usr.sbin/makefs/cd9660.c | 14 | ||||
-rw-r--r-- | usr.sbin/makefs/cd9660.h | 3 | ||||
-rw-r--r-- | usr.sbin/makefs/cd9660/cd9660_conversion.c | 2 | ||||
-rw-r--r-- | usr.sbin/makefs/cd9660/cd9660_eltorito.c | 16 | ||||
-rw-r--r-- | usr.sbin/makefs/cd9660/cd9660_write.c | 4 | ||||
-rw-r--r-- | usr.sbin/makefs/cd9660/iso9660_rrip.c | 24 |
6 files changed, 32 insertions, 31 deletions
diff --git a/usr.sbin/makefs/cd9660.c b/usr.sbin/makefs/cd9660.c index 281a2038489c..44af9840bd27 100644 --- a/usr.sbin/makefs/cd9660.c +++ b/usr.sbin/makefs/cd9660.c @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660.c,v 1.27 2010/10/27 18:51:34 christos Exp $ */ +/* $NetBSD: cd9660.c,v 1.31 2011/08/06 23:25:19 christos Exp $ */ /* * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan @@ -127,7 +127,7 @@ static int cd9660_setup_volume_descriptors(void); static int cd9660_fill_extended_attribute_record(cd9660node *); #endif static void cd9660_sort_nodes(cd9660node *); -static int cd9960_translate_node_common(cd9660node *); +static int cd9660_translate_node_common(cd9660node *); static int cd9660_translate_node(fsnode *, cd9660node *); static int cd9660_compare_filename(const char *, const char *); static void cd9660_sorted_child_insert(cd9660node *, cd9660node *); @@ -809,7 +809,7 @@ cd9660_fill_extended_attribute_record(cd9660node *node) #endif static int -cd9960_translate_node_common(cd9660node *newnode) +cd9660_translate_node_common(cd9660node *newnode) { time_t tim; int test; @@ -846,7 +846,7 @@ cd9960_translate_node_common(cd9660node *newnode) } /* - * Translate fsnode to cd9960node + * Translate fsnode to cd9660node * Translate filenames and other metadata, including dates, sizes, * permissions, etc * @param struct fsnode * The node generated by makefs @@ -875,7 +875,7 @@ cd9660_translate_node(fsnode *node, cd9660node *newnode) if (!(S_ISDIR(node->type))) newnode->fileDataLength = node->inode->st.st_size; - if (cd9960_translate_node_common(newnode) == 0) + if (cd9660_translate_node_common(newnode) == 0) return 0; /* Finally, overwrite some of the values that are set by default */ @@ -2042,7 +2042,7 @@ cd9660_create_file(const char * name, cd9660node *parent, cd9660node *me) return NULL; *temp->node->inode = *me->node->inode; - if (cd9960_translate_node_common(temp) == 0) + if (cd9660_translate_node_common(temp) == 0) return NULL; return temp; } @@ -2069,7 +2069,7 @@ cd9660_create_directory(const char *name, cd9660node *parent, cd9660node *me) return NULL; *temp->node->inode = *me->node->inode; - if (cd9960_translate_node_common(temp) == 0) + if (cd9660_translate_node_common(temp) == 0) return NULL; return temp; } diff --git a/usr.sbin/makefs/cd9660.h b/usr.sbin/makefs/cd9660.h index 79f0a9d0c1ae..108dd48cca12 100644 --- a/usr.sbin/makefs/cd9660.h +++ b/usr.sbin/makefs/cd9660.h @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660.h,v 1.15 2010/10/27 18:51:34 christos Exp $ */ +/* $NetBSD: cd9660.h,v 1.17 2011/06/23 02:35:56 enami Exp $ */ /* * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan @@ -50,6 +50,7 @@ #include <limits.h> #include <sys/queue.h> #include <sys/param.h> +#include <sys/endian.h> #include "makefs.h" #include "iso.h" diff --git a/usr.sbin/makefs/cd9660/cd9660_conversion.c b/usr.sbin/makefs/cd9660/cd9660_conversion.c index e815028a1b6a..43fc7c5e488e 100644 --- a/usr.sbin/makefs/cd9660/cd9660_conversion.c +++ b/usr.sbin/makefs/cd9660/cd9660_conversion.c @@ -36,8 +36,6 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include <sys/endian.h> - static char cd9660_compute_gm_offset(time_t); #if 0 diff --git a/usr.sbin/makefs/cd9660/cd9660_eltorito.c b/usr.sbin/makefs/cd9660/cd9660_eltorito.c index 2f45e9d5176d..ca3dfd9bd2bc 100644 --- a/usr.sbin/makefs/cd9660/cd9660_eltorito.c +++ b/usr.sbin/makefs/cd9660/cd9660_eltorito.c @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660_eltorito.c,v 1.14 2010/10/27 18:51:35 christos Exp $ */ +/* $NetBSD: cd9660_eltorito.c,v 1.17 2011/06/23 02:35:56 enami Exp $ */ /* * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan @@ -32,8 +32,6 @@ * OF SUCH DAMAGE. */ -#include <sys/endian.h> - #include "cd9660.h" #include "cd9660_eltorito.h" @@ -501,13 +499,14 @@ cd9660_setup_boot_volume_descriptor(volume_descriptor *bvd) } static int -cd9660_write_mbr_partition_entry(FILE *fd, int index, off_t sector_start, +cd9660_write_mbr_partition_entry(FILE *fd, int idx, off_t sector_start, off_t nsectors, int type) { uint8_t val; uint32_t lba; - fseeko(fd, (off_t)(index) * 16 + 0x1be, SEEK_SET); + if (fseeko(fd, (off_t)(idx) * 16 + 0x1be, SEEK_SET) == -1) + err(1, "fseeko"); val = 0x80; /* Bootable */ fwrite(&val, sizeof(val), 1, fd); @@ -531,18 +530,19 @@ cd9660_write_mbr_partition_entry(FILE *fd, int index, off_t sector_start, lba = htole32(nsectors); fwrite(&lba, sizeof(lba), 1, fd); - return (0); + return 0; } static int -cd9660_write_apm_partition_entry(FILE *fd, int index, int total_partitions, +cd9660_write_apm_partition_entry(FILE *fd, int idx, int total_partitions, off_t sector_start, off_t nsectors, off_t sector_size, const char *part_name, const char *part_type) { uint32_t apm32; uint16_t apm16; - fseeko(fd, (off_t)(index + 1) * sector_size, SEEK_SET); + if (fseeko(fd, (off_t)(idx + 1) * sector_size, SEEK_SET) == -1) + err(1, "fseeko"); /* Signature */ apm16 = htobe16(0x504d); diff --git a/usr.sbin/makefs/cd9660/cd9660_write.c b/usr.sbin/makefs/cd9660/cd9660_write.c index 46227016f4c4..4c2a24a1d1cd 100644 --- a/usr.sbin/makefs/cd9660/cd9660_write.c +++ b/usr.sbin/makefs/cd9660/cd9660_write.c @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660_write.c,v 1.13 2010/10/22 00:49:15 christos Exp $ */ +/* $NetBSD: cd9660_write.c,v 1.14 2011/01/04 09:48:21 wiz Exp $ */ /* * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan @@ -460,6 +460,7 @@ cd9660_copy_file(FILE *fd, off_t start_sector, const char *filename) if (ferror(rf)) { warn("%s: fread", __func__); free(buf); + (void)fclose(rf); return 0; } @@ -467,6 +468,7 @@ cd9660_copy_file(FILE *fd, off_t start_sector, const char *filename) if (ferror(fd)) { warn("%s: fwrite", __func__); free(buf); + (void)fclose(rf); return 0; } sector++; diff --git a/usr.sbin/makefs/cd9660/iso9660_rrip.c b/usr.sbin/makefs/cd9660/iso9660_rrip.c index 71f77aa6b6b1..68de7ccc0e5c 100644 --- a/usr.sbin/makefs/cd9660/iso9660_rrip.c +++ b/usr.sbin/makefs/cd9660/iso9660_rrip.c @@ -1,4 +1,4 @@ -/* $NetBSD: iso9660_rrip.c,v 1.8 2009/01/10 22:06:29 bjh21 Exp $ */ +/* $NetBSD: iso9660_rrip.c,v 1.10 2011/05/29 17:07:58 tsutsui Exp $ */ /* * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan @@ -183,10 +183,11 @@ cd9660_rrip_finalize_node(cd9660node *node) break; case SUSP_ENTRY_RRIP_PL: /* Look at rr_real_parent */ - if (node->rr_real_parent == NULL) + if (node->parent == NULL || + node->parent->rr_real_parent == NULL) return -1; cd9660_bothendian_dword( - node->rr_real_parent->fileDataSector, + node->parent->rr_real_parent->fileDataSector, (unsigned char *) t->attr.rr_entry.PL.dir_loc); break; @@ -396,6 +397,13 @@ cd9660_rrip_initialize_node(cd9660node *node, cd9660node *parent, cd9660node_rrip_px(current, grandparent->node); TAILQ_INSERT_TAIL(&node->head, current, rr_ll); } + /* Handle PL */ + if (parent != NULL && parent->rr_real_parent != NULL) { + current = cd9660node_susp_create_node(SUSP_TYPE_RRIP, + SUSP_ENTRY_RRIP_PL, "PL", SUSP_LOC_DOTDOT); + cd9660_rrip_PL(current,node); + TAILQ_INSERT_TAIL(&node->head, current, rr_ll); + } } else { cd9660_rrip_initialize_inode(node); @@ -435,14 +443,6 @@ cd9660_rrip_initialize_node(cd9660node *node, cd9660node *parent, SUSP_ENTRY_RRIP_RE, "RE", SUSP_LOC_ENTRY); cd9660_rrip_RE(current,node); TAILQ_INSERT_TAIL(&node->head, current, rr_ll); - - /* Handle PL */ - current = cd9660node_susp_create_node(SUSP_TYPE_RRIP, - SUSP_ENTRY_RRIP_PL, "PL", SUSP_LOC_DOTDOT); - cd9660_rrip_PL(current,node->dot_dot_record); - TAILQ_INSERT_TAIL(&node->dot_dot_record->head, current, - rr_ll); - TAILQ_INSERT_TAIL(&node->head, current, rr_ll); } } return 1; @@ -496,7 +496,7 @@ cd9660_rrip_CL(struct ISO_SUSP_ATTRIBUTES *p, cd9660node *node __unused) int cd9660_rrip_RE(struct ISO_SUSP_ATTRIBUTES *p, cd9660node *node __unused) { - p->attr.rr_entry.RE.h.length[0] = 0; + p->attr.rr_entry.RE.h.length[0] = 4; p->attr.rr_entry.RE.h.version[0] = 1; return 1; } |