CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: mrg Date: Thu Aug 3 08:06:11 UTC 2023 Modified Files: src/sbin/fsck_udf: main.c Log Message: avoid double-free. found by GCC 12. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_udf/main.c diff -u src/sbin/fsck_udf/main.c:1.13 src/sbin/fsck_udf/main.c:1.14 --- src/sbin/fsck_udf/main.c:1.13 Mon Apr 25 15:37:14 2022 +++ src/sbin/fsck_udf/main.c Thu Aug 3 08:06:11 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.13 2022/04/25 15:37:14 reinoud Exp $ */ +/* $NetBSD: main.c,v 1.14 2023/08/03 08:06:11 mrg Exp $ */ /* * Copyright (c) 2022 Reinoud Zandijk @@ -37,7 +37,7 @@ #include #ifndef lint -__RCSID("$NetBSD: main.c,v 1.13 2022/04/25 15:37:14 reinoud Exp $"); +__RCSID("$NetBSD: main.c,v 1.14 2023/08/03 08:06:11 mrg Exp $"); #endif /* not lint */ #include @@ -2800,6 +2800,7 @@ udf_check_VDS_areas(void) { context.vds_buf = vds1_buf; context.vds_size = vds1_size; free(vds2_buf); + vds2_buf = NULL; } if (!error2) { /* retrieve data from VDS 2 */ @@ -2807,6 +2808,7 @@ udf_check_VDS_areas(void) { context.vds_buf = vds2_buf; context.vds_size = vds2_size; free(vds1_buf); + vds1_buf = NULL; } /* check if all is correct and complete */ error = udf_process_vds();
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: mrg Date: Thu Aug 3 08:06:11 UTC 2023 Modified Files: src/sbin/fsck_udf: main.c Log Message: avoid double-free. found by GCC 12. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: reinoud Date: Mon Apr 25 15:37:14 UTC 2022 Modified Files: src/sbin/fsck_udf: main.c Log Message: Relax constraints on sequential media detection by checking for VAT format. This allows fixing images of VAT formatted media too. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_udf/main.c diff -u src/sbin/fsck_udf/main.c:1.12 src/sbin/fsck_udf/main.c:1.13 --- src/sbin/fsck_udf/main.c:1.12 Mon Apr 25 15:18:15 2022 +++ src/sbin/fsck_udf/main.c Mon Apr 25 15:37:14 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.12 2022/04/25 15:18:15 reinoud Exp $ */ +/* $NetBSD: main.c,v 1.13 2022/04/25 15:37:14 reinoud Exp $ */ /* * Copyright (c) 2022 Reinoud Zandijk @@ -37,7 +37,7 @@ #include #ifndef lint -__RCSID("$NetBSD: main.c,v 1.12 2022/04/25 15:18:15 reinoud Exp $"); +__RCSID("$NetBSD: main.c,v 1.13 2022/04/25 15:37:14 reinoud Exp $"); #endif /* not lint */ #include @@ -2862,9 +2862,8 @@ udf_prepare_writing(void) } /* if we are not on sequential media, we're done */ - if ((mmc_discinfo.mmc_cur & MMC_CAP_SEQUENTIAL) == 0) + if ((context.format_flags & FORMAT_VAT) == 0) return 0; - assert(context.format_flags & FORMAT_VAT); /* if the disc is full, we drop back to read only */ if (mmc_discinfo.disc_state == MMC_STATE_FULL)
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: reinoud Date: Mon Apr 25 15:37:14 UTC 2022 Modified Files: src/sbin/fsck_udf: main.c Log Message: Relax constraints on sequential media detection by checking for VAT format. This allows fixing images of VAT formatted media too. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: reinoud Date: Mon Apr 25 15:18:15 UTC 2022 Modified Files: src/sbin/fsck_udf: main.c Log Message: Fix endian bug in descriptor CRC length on updating a FE/EFE To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_udf/main.c diff -u src/sbin/fsck_udf/main.c:1.11 src/sbin/fsck_udf/main.c:1.12 --- src/sbin/fsck_udf/main.c:1.11 Sun Apr 24 15:07:08 2022 +++ src/sbin/fsck_udf/main.c Mon Apr 25 15:18:15 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.11 2022/04/24 15:07:08 reinoud Exp $ */ +/* $NetBSD: main.c,v 1.12 2022/04/25 15:18:15 reinoud Exp $ */ /* * Copyright (c) 2022 Reinoud Zandijk @@ -37,7 +37,7 @@ #include #ifndef lint -__RCSID("$NetBSD: main.c,v 1.11 2022/04/24 15:07:08 reinoud Exp $"); +__RCSID("$NetBSD: main.c,v 1.12 2022/04/25 15:18:15 reinoud Exp $"); #endif /* not lint */ #include @@ -3661,7 +3661,7 @@ udf_node_pass3_writeout_update(struct ud { struct file_entry*fe = NULL; struct extfile_entry *efe = NULL; - int error; + int crc_len, error; vat_writeout = 1; if (udf_rw16(dscr->tag.id) == TAGID_FENTRY) { @@ -3682,7 +3682,8 @@ udf_node_pass3_writeout_update(struct ud } /* fixup CRC length (if needed) */ - dscr->tag.desc_crc_len = udf_tagsize(dscr, 1) - sizeof(struct desc_tag); + crc_len = udf_tagsize(dscr, 1) - sizeof(struct desc_tag); + dscr->tag.desc_crc_len = udf_rw16(crc_len); pwarn("%s : updating node\n", udf_node_path(node)); error = udf_write_dscr_virt(dscr, udf_rw32(node->loc.loc.lb_num),
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: reinoud Date: Mon Apr 25 15:18:15 UTC 2022 Modified Files: src/sbin/fsck_udf: main.c Log Message: Fix endian bug in descriptor CRC length on updating a FE/EFE To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: reinoud Date: Sun Apr 24 15:07:08 UTC 2022 Modified Files: src/sbin/fsck_udf: main.c Log Message: Fix endian bug in allocation extents processing To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_udf/main.c diff -u src/sbin/fsck_udf/main.c:1.10 src/sbin/fsck_udf/main.c:1.11 --- src/sbin/fsck_udf/main.c:1.10 Fri Apr 22 21:07:56 2022 +++ src/sbin/fsck_udf/main.c Sun Apr 24 15:07:08 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.10 2022/04/22 21:07:56 reinoud Exp $ */ +/* $NetBSD: main.c,v 1.11 2022/04/24 15:07:08 reinoud Exp $ */ /* * Copyright (c) 2022 Reinoud Zandijk @@ -37,7 +37,7 @@ #include #ifndef lint -__RCSID("$NetBSD: main.c,v 1.10 2022/04/22 21:07:56 reinoud Exp $"); +__RCSID("$NetBSD: main.c,v 1.11 2022/04/24 15:07:08 reinoud Exp $"); #endif /* not lint */ #include @@ -1088,7 +1088,7 @@ udf_process_file(union dscrptr *dscrptr, lb_num, vpart_num, 1); /* TODO check for prev_entry? */ - l_ad = ext->l_ad; + l_ad = udf_rw32(ext->l_ad); bpos = ext->data; if (ad_type == UDF_ICB_SHORT_ALLOC) short_adp = (struct short_ad *) bpos;
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: reinoud Date: Sun Apr 24 15:07:08 UTC 2022 Modified Files: src/sbin/fsck_udf: main.c Log Message: Fix endian bug in allocation extents processing To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: reinoud Date: Fri Apr 22 21:07:56 UTC 2022 Modified Files: src/sbin/fsck_udf: main.c Log Message: Remove the error condition for these cases; the VAT LVExtension is missing/corrupt but fsck_udf will reconstruct them anyway. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_udf/main.c diff -u src/sbin/fsck_udf/main.c:1.9 src/sbin/fsck_udf/main.c:1.10 --- src/sbin/fsck_udf/main.c:1.9 Fri Apr 22 21:00:28 2022 +++ src/sbin/fsck_udf/main.c Fri Apr 22 21:07:56 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.9 2022/04/22 21:00:28 reinoud Exp $ */ +/* $NetBSD: main.c,v 1.10 2022/04/22 21:07:56 reinoud Exp $ */ /* * Copyright (c) 2022 Reinoud Zandijk @@ -37,7 +37,7 @@ #include #ifndef lint -__RCSID("$NetBSD: main.c,v 1.9 2022/04/22 21:00:28 reinoud Exp $"); +__RCSID("$NetBSD: main.c,v 1.10 2022/04/22 21:07:56 reinoud Exp $"); #endif /* not lint */ #include @@ -1873,6 +1873,7 @@ udf_extract_vat(union dscrptr *dscr, uin error = udf_extattr_search_intern(dscr, 2048, extstr, , _l); if (error) { /* VAT LVExtension extended attribute missing */ + error = 0; vat_writeout = 1; goto ok; } @@ -1881,6 +1882,7 @@ udf_extract_vat(union dscrptr *dscr, uin error = udf_impl_extattr_check(implext); if (error) { /* VAT LVExtension checksum failed */ + error = 0; vat_writeout = 1; goto ok; } @@ -1888,6 +1890,7 @@ udf_extract_vat(union dscrptr *dscr, uin /* paranoia */ if (a_l != sizeof(*implext) -2 + udf_rw32(implext->iu_l) + sizeof(lvext)) { /* VAT LVExtension size doesn't compute */ + error = 0; vat_writeout = 1; goto ok; }
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: reinoud Date: Fri Apr 22 21:07:56 UTC 2022 Modified Files: src/sbin/fsck_udf: main.c Log Message: Remove the error condition for these cases; the VAT LVExtension is missing/corrupt but fsck_udf will reconstruct them anyway. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: reinoud Date: Fri Apr 22 21:00:28 UTC 2022 Modified Files: src/sbin/fsck_udf: main.c Log Message: Prevent reading beyond the early_vat_location To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_udf/main.c diff -u src/sbin/fsck_udf/main.c:1.8 src/sbin/fsck_udf/main.c:1.9 --- src/sbin/fsck_udf/main.c:1.8 Fri Apr 22 20:56:46 2022 +++ src/sbin/fsck_udf/main.c Fri Apr 22 21:00:28 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.8 2022/04/22 20:56:46 reinoud Exp $ */ +/* $NetBSD: main.c,v 1.9 2022/04/22 21:00:28 reinoud Exp $ */ /* * Copyright (c) 2022 Reinoud Zandijk @@ -37,7 +37,7 @@ #include #ifndef lint -__RCSID("$NetBSD: main.c,v 1.8 2022/04/22 20:56:46 reinoud Exp $"); +__RCSID("$NetBSD: main.c,v 1.9 2022/04/22 21:00:28 reinoud Exp $"); #endif /* not lint */ #include @@ -2148,6 +2148,8 @@ udf_search_vat(union udf_pmap *mapping, } else { late_vat_loc = early_vat_loc - 1; } + if (early_vat_loc == first_possible_vat_location) + break; early_vat_loc = first_possible_vat_location; if (late_vat_loc > VAT_BLK) early_vat_loc = MAX(early_vat_loc, late_vat_loc - VAT_BLK);
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: reinoud Date: Fri Apr 22 21:00:28 UTC 2022 Modified Files: src/sbin/fsck_udf: main.c Log Message: Prevent reading beyond the early_vat_location To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: reinoud Date: Fri Apr 22 19:21:08 UTC 2022 Modified Files: src/sbin/fsck_udf: main.c Log Message: Avoid assigned but unused compiler warnings when compiling with clang To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_udf/main.c diff -u src/sbin/fsck_udf/main.c:1.6 src/sbin/fsck_udf/main.c:1.7 --- src/sbin/fsck_udf/main.c:1.6 Sat Apr 9 09:59:16 2022 +++ src/sbin/fsck_udf/main.c Fri Apr 22 19:21:08 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.6 2022/04/09 09:59:16 riastradh Exp $ */ +/* $NetBSD: main.c,v 1.7 2022/04/22 19:21:08 reinoud Exp $ */ /* * Copyright (c) 2022 Reinoud Zandijk @@ -37,7 +37,7 @@ #include #ifndef lint -__RCSID("$NetBSD: main.c,v 1.6 2022/04/09 09:59:16 riastradh Exp $"); +__RCSID("$NetBSD: main.c,v 1.7 2022/04/22 19:21:08 reinoud Exp $"); #endif /* not lint */ #include @@ -3545,6 +3545,7 @@ udf_process_node_pass1(struct udf_fsck_n udf_node_path(node)); return EINVAL; } + (void) fpos; return 0; } @@ -3646,6 +3647,7 @@ udf_node_pass3_repairdir(struct udf_fsck _context); if (error) pwarn("Failed to write out directory!\n"); + (void) fpos; }
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: reinoud Date: Fri Apr 22 19:21:08 UTC 2022 Modified Files: src/sbin/fsck_udf: main.c Log Message: Avoid assigned but unused compiler warnings when compiling with clang To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: riastradh Date: Sat Apr 9 09:59:16 UTC 2022 Modified Files: src/sbin/fsck_udf: main.c Log Message: fsck_udf(8): Nix trailing whitespace. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_udf/main.c diff -u src/sbin/fsck_udf/main.c:1.5 src/sbin/fsck_udf/main.c:1.6 --- src/sbin/fsck_udf/main.c:1.5 Fri Apr 8 23:48:05 2022 +++ src/sbin/fsck_udf/main.c Sat Apr 9 09:59:16 2022 @@ -1,9 +1,9 @@ -/* $NetBSD: main.c,v 1.5 2022/04/08 23:48:05 riastradh Exp $ */ +/* $NetBSD: main.c,v 1.6 2022/04/09 09:59:16 riastradh Exp $ */ /* * Copyright (c) 2022 Reinoud Zandijk * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -12,7 +12,7 @@ * 2. Redistributions in binary form must reproduce the above copyright *notice, this list of conditions and the following disclaimer in the *documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. @@ -23,7 +23,7 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * */ @@ -37,7 +37,7 @@ #include #ifndef lint -__RCSID("$NetBSD: main.c,v 1.5 2022/04/08 23:48:05 riastradh Exp $"); +__RCSID("$NetBSD: main.c,v 1.6 2022/04/09 09:59:16 riastradh Exp $"); #endif /* not lint */ #include @@ -1282,7 +1282,7 @@ udf_get_anchors(void) break; } /* support for track 512 */ - if (ti.flags & MMC_TRACKINFO_BLANK) + if (ti.flags & MMC_TRACKINFO_BLANK) context.format_flags |= FORMAT_TRACK512; assert(!error); @@ -1743,7 +1743,7 @@ udf_file_mtime(union dscrptr *dscr) assert((tag_id == TAGID_FENTRY) || (tag_id == TAGID_EXTFENTRY)); if (tag_id == TAGID_FENTRY) return >fe.mtime; - else + else return >efe.mtime; ; } @@ -2159,7 +2159,7 @@ udf_search_vat(union udf_pmap *mapping, undo_opening_session = 0; if (!accepted_vat) { - if ((context.last_ti.sessionnr > 1) && + if ((context.last_ti.sessionnr > 1) && ask_noauto(0, "Undo opening of last session")) { undo_opening_session = 1; pwarn("Undoing opening of last session not implemented!\n"); @@ -2385,7 +2385,7 @@ udf_process_vds(void) { struct long_ad fsd_loc; uint8_t *pmap_pos; char *domain_name, *map_name; - const char *check_name; + const char *check_name; int pmap_stype, pmap_size; int pmap_type, log_part, phys_part, raw_phys_part; //, maps_on; int n_pm, n_phys, n_virt, n_spar, n_meta; @@ -2872,7 +2872,7 @@ udf_prepare_writing(void) error = udf_update_trackinfo(); if (error) return error; - if (!(ti.flags & MMC_TRACKINFO_BLANK) && + if (!(ti.flags & MMC_TRACKINFO_BLANK) && (ti.flags & MMC_TRACKINFO_NWA_VALID)) { /* * Not closed; translate next_writable to a position relative to our @@ -4075,7 +4075,7 @@ udf_check_directory_tree(void) if (cur_node->fsck_flags & FSCK_NODE_FLAG_DIRECTORY) context.num_directories++; - else + else context.num_files += link_count; ; }
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: riastradh Date: Sat Apr 9 09:59:16 UTC 2022 Modified Files: src/sbin/fsck_udf: main.c Log Message: fsck_udf(8): Nix trailing whitespace. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: riastradh Date: Fri Apr 8 23:48:05 UTC 2022 Modified Files: src/sbin/fsck_udf: main.c Log Message: fsck_udf(8): Mark vat_length as ignored. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_udf/main.c diff -u src/sbin/fsck_udf/main.c:1.4 src/sbin/fsck_udf/main.c:1.5 --- src/sbin/fsck_udf/main.c:1.4 Fri Apr 8 23:47:19 2022 +++ src/sbin/fsck_udf/main.c Fri Apr 8 23:48:05 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.4 2022/04/08 23:47:19 riastradh Exp $ */ +/* $NetBSD: main.c,v 1.5 2022/04/08 23:48:05 riastradh Exp $ */ /* * Copyright (c) 2022 Reinoud Zandijk @@ -37,7 +37,7 @@ #include #ifndef lint -__RCSID("$NetBSD: main.c,v 1.4 2022/04/08 23:47:19 riastradh Exp $"); +__RCSID("$NetBSD: main.c,v 1.5 2022/04/08 23:48:05 riastradh Exp $"); #endif /* not lint */ #include @@ -1782,6 +1782,7 @@ udf_check_for_vat(union dscrptr *dscr) return ENOENT; /* TODO sanity check vat length */ + (void)vat_length; return 0; }
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: riastradh Date: Fri Apr 8 23:48:05 UTC 2022 Modified Files: src/sbin/fsck_udf: main.c Log Message: fsck_udf(8): Mark vat_length as ignored. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: riastradh Date: Fri Apr 8 23:47:19 UTC 2022 Modified Files: src/sbin/fsck_udf: main.c Log Message: fsck_udf(8): Sprinkle __printflike and omit self-assignment. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_udf/main.c diff -u src/sbin/fsck_udf/main.c:1.3 src/sbin/fsck_udf/main.c:1.4 --- src/sbin/fsck_udf/main.c:1.3 Wed Apr 6 16:01:06 2022 +++ src/sbin/fsck_udf/main.c Fri Apr 8 23:47:19 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.3 2022/04/06 16:01:06 martin Exp $ */ +/* $NetBSD: main.c,v 1.4 2022/04/08 23:47:19 riastradh Exp $ */ /* * Copyright (c) 2022 Reinoud Zandijk @@ -37,7 +37,7 @@ #include #ifndef lint -__RCSID("$NetBSD: main.c,v 1.3 2022/04/06 16:01:06 martin Exp $"); +__RCSID("$NetBSD: main.c,v 1.4 2022/04/08 23:47:19 riastradh Exp $"); #endif /* not lint */ #include @@ -1782,7 +1782,6 @@ udf_check_for_vat(union dscrptr *dscr) return ENOENT; /* TODO sanity check vat length */ - vat_length = vat_length; return 0; } @@ -4405,7 +4404,7 @@ main(int argc, char **argv) /*VARARGS*/ -static int +static int __printflike(2, 3) ask(int def, const char *fmt, ...) { va_list ap; @@ -4438,7 +4437,7 @@ ask(int def, const char *fmt, ...) /*VARARGS*/ -static int +static int __printflike(2, 3) ask_noauto(int def, const char *fmt, ...) { va_list ap;
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: riastradh Date: Fri Apr 8 23:47:19 UTC 2022 Modified Files: src/sbin/fsck_udf: main.c Log Message: fsck_udf(8): Sprinkle __printflike and omit self-assignment. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: martin Date: Wed Apr 6 16:01:07 UTC 2022 Modified Files: src/sbin/fsck_udf: main.c Log Message: Use PRI macros for uint64_t printf formats, %zu for size_t. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_udf/main.c diff -u src/sbin/fsck_udf/main.c:1.2 src/sbin/fsck_udf/main.c:1.3 --- src/sbin/fsck_udf/main.c:1.2 Wed Apr 6 13:42:39 2022 +++ src/sbin/fsck_udf/main.c Wed Apr 6 16:01:06 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.2 2022/04/06 13:42:39 wiz Exp $ */ +/* $NetBSD: main.c,v 1.3 2022/04/06 16:01:06 martin Exp $ */ /* * Copyright (c) 2022 Reinoud Zandijk @@ -37,7 +37,7 @@ #include #ifndef lint -__RCSID("$NetBSD: main.c,v 1.2 2022/04/06 13:42:39 wiz Exp $"); +__RCSID("$NetBSD: main.c,v 1.3 2022/04/06 16:01:06 martin Exp $"); #endif /* not lint */ #include @@ -520,7 +520,7 @@ udf_rebuild_fid_stream(struct udf_fsck_n } if (sfpos != dfpos) - printf("%s: could save %ld bytes in directory\n", udf_node_path(node), sfpos - dfpos); + printf("%s: could save %" PRIi64 " bytes in directory\n", udf_node_path(node), sfpos - dfpos); memset(directory, 0, inf_len); memcpy(directory, rebuild_dir, dfpos); @@ -2985,7 +2985,7 @@ udf_close_volume(void) /* check our highest unique id */ if (context.unique_id > udf_rw64(lvid->lvint_next_unique_id)) { - pwarn("Last unique id updated from %ld to %ld : FIXED\n", + pwarn("Last unique id updated from %" PRIi64 " to %" PRIi64 " : FIXED\n", udf_rw64(lvid->lvint_next_unique_id), context.unique_id); open_integrity = 1; @@ -3299,7 +3299,7 @@ udf_fixup_lengths_pass1(struct udf_fsck_ diff = node->found.inf_len - node->declared.inf_len; if (diff) { pwarn("%s : recorded information length incorrect: " - "%lu instead of declared %lu\n", + "%" PRIu64 " instead of declared %" PRIu64 "\n", udf_node_path(node), node->found.inf_len, node->declared.inf_len); node->declared.inf_len = node->found.inf_len; @@ -3311,7 +3311,7 @@ udf_fixup_lengths_pass1(struct udf_fsck_ diff = node->found.logblks_rec - node->declared.logblks_rec; if (diff) { pwarn("%s : logical blocks recorded incorrect: " - "%lu instead of declared %lu, fixing\n", + "%" PRIu64 " instead of declared %" PRIu64 ", fixing\n", udf_node_path(node), node->found.logblks_rec, node->declared.logblks_rec); node->declared.logblks_rec = node->found.logblks_rec; @@ -3332,7 +3332,7 @@ udf_fixup_lengths_pass1(struct udf_fsck_ if (udf_rw16(dscr->tag.desc_crc_len) != udf_tagsize(dscr, 1) - sizeof(struct desc_tag)) { pwarn("%s : node file descriptor CRC length mismatch; " - "%d declared, %ld expected\n", + "%d declared, %zu\n", udf_node_path(node), udf_rw16(dscr->tag.desc_crc_len), udf_tagsize(dscr, 1) - sizeof(struct desc_tag)); udf_recursive_keep(node); @@ -4020,7 +4020,7 @@ udf_check_directory_tree(void) /* object sizes */ if (cur_node->declared.obj_size != cur_node->found.obj_size) { pwarn("%s : recorded object size incorrect; " - "%lu instead of declared %lu\n", + "%" PRIu64 " instead of declared %" PRIu64 "\n", udf_node_path(cur_node), cur_node->found.obj_size, cur_node->declared.obj_size); cur_node->declared.obj_size = cur_node->found.obj_size;
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: martin Date: Wed Apr 6 16:01:07 UTC 2022 Modified Files: src/sbin/fsck_udf: main.c Log Message: Use PRI macros for uint64_t printf formats, %zu for size_t. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: wiz Date: Wed Apr 6 13:42:40 UTC 2022 Modified Files: src/sbin/fsck_udf: main.c Log Message: fsck_udf: match usage to man page; fix typos To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_udf/main.c diff -u src/sbin/fsck_udf/main.c:1.1 src/sbin/fsck_udf/main.c:1.2 --- src/sbin/fsck_udf/main.c:1.1 Wed Apr 6 13:35:50 2022 +++ src/sbin/fsck_udf/main.c Wed Apr 6 13:42:39 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.1 2022/04/06 13:35:50 reinoud Exp $ */ +/* $NetBSD: main.c,v 1.2 2022/04/06 13:42:39 wiz Exp $ */ /* * Copyright (c) 2022 Reinoud Zandijk @@ -37,7 +37,7 @@ #include #ifndef lint -__RCSID("$NetBSD: main.c,v 1.1 2022/04/06 13:35:50 reinoud Exp $"); +__RCSID("$NetBSD: main.c,v 1.2 2022/04/06 13:42:39 wiz Exp $"); #endif /* not lint */ #include @@ -1040,7 +1040,7 @@ udf_process_file(union dscrptr *dscrptr, case UDF_EXT_REDIRECT : if (piece_len != context.sector_size) { /* should this be an error? */ -pwarn("Got extention redirect with wrong size %d\n", +pwarn("Got extension redirect with wrong size %d\n", piece_len); error = EINVAL; break; @@ -3501,7 +3501,7 @@ udf_process_node_pass1(struct udf_fsck_n node->fsck_flags |= FSCK_NODE_FLAG_PAR_NOT_FOUND; rest_len = node->found.inf_len; - /* walk trough all our FIDs in the directory stream */ + /* walk through all our FIDs in the directory stream */ bpos = node->directory; fpos = 0; while (rest_len > 0) { @@ -4321,7 +4321,7 @@ checkfilesys(char *given_dev) static void usage(void) { - (void)fprintf(stderr, "Usage: %s [-psSynfH] filesystem ... \n", + (void)fprintf(stderr, "Usage: %s [-fHnpSsy] file-system ... \n", getprogname()); exit(FSCK_EXIT_USAGE); }
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: wiz Date: Wed Apr 6 13:42:40 UTC 2022 Modified Files: src/sbin/fsck_udf: main.c Log Message: fsck_udf: match usage to man page; fix typos To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: wiz Date: Wed Apr 6 13:41:14 UTC 2022 Modified Files: src/sbin/fsck_udf: fsck_udf.8 Log Message: New sentence, new line. Sort options. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sbin/fsck_udf/fsck_udf.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/fsck_udf/fsck_udf.8 diff -u src/sbin/fsck_udf/fsck_udf.8:1.1 src/sbin/fsck_udf/fsck_udf.8:1.2 --- src/sbin/fsck_udf/fsck_udf.8:1.1 Wed Apr 6 13:35:50 2022 +++ src/sbin/fsck_udf/fsck_udf.8 Wed Apr 6 13:41:13 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: fsck_udf.8,v 1.1 2022/04/06 13:35:50 reinoud Exp $ +.\" $NetBSD: fsck_udf.8,v 1.2 2022/04/06 13:41:13 wiz Exp $ .\" .\" Copyright (C) 2022 Reinoud Zandijk .\" Based on fsck_msdos(8) by @@ -31,32 +31,32 @@ .Os .Sh NAME .Nm fsck_udf -.Nd Universal Disk Format filesystem consistency checker +.Nd Universal Disk Format file system consistency checker .Sh SYNOPSIS .Nm .Fl p .Op Fl fH -.Ar filesystem ... +.Ar file system ... .Nm -.Op Fl sSynfH -.Ar filesystem ... +.Op Fl fHnSsy +.Ar file system ... .Sh DESCRIPTION The .Nm utility verifies and repairs .Tn Universal Disk Format -filesystems (more commonly known as +file systems (more commonly known as .Tn UDF -filesystems). +file systems). .Pp The first form of .Nm -preens the specified filesystems. +preens the specified file systems. It is normally started by .Xr fsck 8 run from .Pa /etc/rc -during automatic reboot, when an UDF filesystem is detected. +during automatic reboot, when an UDF file system is detected. When preening file systems, .Nm will fix common inconsistencies non-interactively. @@ -75,30 +75,31 @@ The options are as follows: .Bl -tag -width XXXoptions .It Fl f Force detailed checking even when file system is marked closed. +.It Fl H +Enables heuristic repair options repairing known corruptions in the wild +caused by bugs. .It Fl n Causes .Nm -to assume no as the answer to all operator -questions. +to assume no as the answer to all operator questions. .It Fl p -Preen the specified filesystems. -.It Fl y +Preen the specified file systems. +.It Fl S Causes .Nm -to assume yes as the answer to all operator questions. +to scan for older VAT tables on recordable media. +This allows older snapshots of the file system on recordable media to +be recovered. .It Fl s Ar session Select session .Ar session -to be checked on recordable media. This allows older sessions -of the file system on recordable media to be recovered. -.It Fl S +to be checked on recordable media. +This allows older sessions of the file system on recordable media to +be recovered. +.It Fl y Causes .Nm -to scan for older VAT tables on recordable media. This allows older snapshots -of the file system on recordable media to be recovered. -.It Fl H -Enables heuristic repair options repairing known corruptions in the wild -caused by bugs. +to assume yes as the answer to all operator questions. .El .Sh SEE ALSO .Xr fsck 8 , @@ -111,5 +112,5 @@ utility appeared in .Nx 10.0 . .Sh BUGS .Nm -is still under construction. Not all possible reparations are implemented. - +is still under construction. +Not all possible reparations are implemented.
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: wiz Date: Wed Apr 6 13:41:14 UTC 2022 Modified Files: src/sbin/fsck_udf: fsck_udf.8 Log Message: New sentence, new line. Sort options. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sbin/fsck_udf/fsck_udf.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: reinoud Date: Wed Apr 6 13:35:50 UTC 2022 Added Files: src/sbin/fsck_udf: Makefile fsck_udf.8 main.c Log Message: Initial commit of the fsck_udf(8) utility that checks and repairs UDF filesystems on optical media as well as on disc images, harddisc partitions and wedges. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sbin/fsck_udf/Makefile \ src/sbin/fsck_udf/fsck_udf.8 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sbin/fsck_udf
Module Name:src Committed By: reinoud Date: Wed Apr 6 13:35:50 UTC 2022 Added Files: src/sbin/fsck_udf: Makefile fsck_udf.8 main.c Log Message: Initial commit of the fsck_udf(8) utility that checks and repairs UDF filesystems on optical media as well as on disc images, harddisc partitions and wedges. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sbin/fsck_udf/Makefile \ src/sbin/fsck_udf/fsck_udf.8 src/sbin/fsck_udf/main.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sbin/fsck_udf/Makefile diff -u /dev/null src/sbin/fsck_udf/Makefile:1.1 --- /dev/null Wed Apr 6 13:35:50 2022 +++ src/sbin/fsck_udf/Makefile Wed Apr 6 13:35:50 2022 @@ -0,0 +1,23 @@ +# $NetBSD: Makefile,v 1.1 2022/04/06 13:35:50 reinoud Exp $ + +.include + +PROG= fsck_udf +MAN= fsck_udf.8 +SRCS= main.c udf_core.c \ + udf_osta.c fattr.c fsutil.c + +FSCK= ${NETBSDSRCDIR}/sbin/fsck +NEWFS= ${NETBSDSRCDIR}/sbin/newfs_udf +MOUNT= ${NETBSDSRCDIR}/sbin/mount +KUDF= ${NETBSDSRCDIR}/sys/fs/udf +CPPFLAGS+= -I${FSCK} -I${KUDF} -I${NEWFS} -I${NETBSDSRCDIR}/sys +.PATH: ${FSCK} ${NEWFS} ${MOUNT} ${KUDF} + +DPADD+=${LIBUTIL} +LDADD+=-lutil -lprop + +CWARNFLAGS.clang+= -Wno-error=address-of-packed-member +CWARNFLAGS.gcc+= ${GCC_NO_ADDR_OF_PACKED_MEMBER} + +.include Index: src/sbin/fsck_udf/fsck_udf.8 diff -u /dev/null src/sbin/fsck_udf/fsck_udf.8:1.1 --- /dev/null Wed Apr 6 13:35:50 2022 +++ src/sbin/fsck_udf/fsck_udf.8 Wed Apr 6 13:35:50 2022 @@ -0,0 +1,115 @@ +.\" $NetBSD: fsck_udf.8,v 1.1 2022/04/06 13:35:50 reinoud Exp $ +.\" +.\" Copyright (C) 2022 Reinoud Zandijk +.\" Based on fsck_msdos(8) by +.\" Copyright (C) 1995 Wolfgang Solfrank +.\" Copyright (c) 1995 Martin Husemann +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\"notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\"notice, this list of conditions and the following disclaimer in the +.\"documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" +.Dd February 6, 2022 +.Dt FSCK_UDF 8 +.Os +.Sh NAME +.Nm fsck_udf +.Nd Universal Disk Format filesystem consistency checker +.Sh SYNOPSIS +.Nm +.Fl p +.Op Fl fH +.Ar filesystem ... +.Nm +.Op Fl sSynfH +.Ar filesystem ... +.Sh DESCRIPTION +The +.Nm +utility verifies and repairs +.Tn Universal Disk Format +filesystems (more commonly known as +.Tn UDF +filesystems). +.Pp +The first form of +.Nm +preens the specified filesystems. +It is normally started by +.Xr fsck 8 +run from +.Pa /etc/rc +during automatic reboot, when an UDF filesystem is detected. +When preening file systems, +.Nm +will fix common inconsistencies non-interactively. +If more serious problems are found, +.Nm +does not try to fix them, indicates that it was not +successful, and exits. +.Pp +The second form of +.Nm +checks the specified file systems and tries to repair all +detected inconsistencies, requesting confirmation before +making any changes. +.Pp +The options are as follows: +.Bl -tag -width XXXoptions +.It Fl f +Force detailed checking even when file system is marked closed. +.It Fl n +Causes +.Nm +to assume no as the answer to all operator +questions. +.It Fl p +Preen the specified filesystems. +.It Fl y +Causes +.Nm +to assume yes as the answer to all operator questions. +.It Fl s Ar session +Select session +.Ar session +to be checked on recordable media. This allows older sessions +of the file system on recordable media to be recovered. +.It Fl S +Causes +.Nm +to scan for older VAT tables on recordable media. This allows older snapshots +of the file system on recordable media to be recovered. +.It Fl H +Enables heuristic repair options repairing known corruptions in the wild +caused by bugs. +.El +.Sh SEE ALSO +.Xr fsck 8 , +.Xr fsck_ffs 8 , +.Xr mount_udf 8 +.Sh HISTORY +A +.Nm +utility appeared in +.Nx 10.0 . +.Sh BUGS +.Nm +is still under construction. Not all possible