Module Name: src
Committed By: reinoud
Date: Fri Apr 22 20:56:46 UTC 2022
Modified Files:
src/sbin/fsck_udf: main.c
src/sbin/newfs_udf: udf_core.c
Log Message:
Fix endian issues with fsck_udf/newfs_udf/makefs
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sbin/fsck_udf/main.c
cvs rdiff -u -r1.2 -r1.3 src/sbin/newfs_udf/udf_core.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.7 src/sbin/fsck_udf/main.c:1.8
--- src/sbin/fsck_udf/main.c:1.7 Fri Apr 22 19:21:08 2022
+++ src/sbin/fsck_udf/main.c Fri Apr 22 20:56:46 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.7 2022/04/22 19:21:08 reinoud Exp $ */
+/* $NetBSD: main.c,v 1.8 2022/04/22 20:56:46 reinoud Exp $ */
/*
* Copyright (c) 2022 Reinoud Zandijk
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: main.c,v 1.7 2022/04/22 19:21:08 reinoud Exp $");
+__RCSID("$NetBSD: main.c,v 1.8 2022/04/22 20:56:46 reinoud Exp $");
#endif /* not lint */
#include <stdio.h>
@@ -362,13 +362,13 @@ udf_wipe_and_reallocate(union dscrptr *d
/* create one short_ad or one long_ad */
if (ad_type == UDF_ICB_SHORT_ALLOC) {
short_adp = (struct short_ad *) bpos;
- short_adp->len = udf_rw64(inf_len);
+ short_adp->len = udf_rw32(inf_len);
short_adp->lb_num = allocated.loc.lb_num;
l_ad = sizeof(struct short_ad);
} else {
long_adp = (struct long_ad *) bpos;
memcpy(long_adp, &allocated, sizeof(struct long_ad));
- long_adp->len = udf_rw64(inf_len);
+ long_adp->len = udf_rw32(inf_len);
l_ad = sizeof(struct long_ad);
}
if (id == TAGID_FENTRY)
@@ -2600,7 +2600,7 @@ udf_process_vds(void) {
* data file length
*/
context.part_size[log_part] =
- udf_rw32(context.meta_file->inf_len) / context.sector_size;
+ udf_rw64(context.meta_file->inf_len) / context.sector_size;
break;
default:
break;
Index: src/sbin/newfs_udf/udf_core.c
diff -u src/sbin/newfs_udf/udf_core.c:1.2 src/sbin/newfs_udf/udf_core.c:1.3
--- src/sbin/newfs_udf/udf_core.c:1.2 Sat Apr 9 09:58:11 2022
+++ src/sbin/newfs_udf/udf_core.c Fri Apr 22 20:56:46 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_core.c,v 1.2 2022/04/09 09:58:11 riastradh Exp $ */
+/* $NetBSD: udf_core.c,v 1.3 2022/04/22 20:56:46 reinoud Exp $ */
/*
* Copyright (c) 2006, 2008, 2021, 2022 Reinoud Zandijk
@@ -30,7 +30,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: udf_core.c,v 1.2 2022/04/09 09:58:11 riastradh Exp $");
+__RCSID("$NetBSD: udf_core.c,v 1.3 2022/04/22 20:56:46 reinoud Exp $");
#include <stdio.h>
#include <stdlib.h>
@@ -2024,7 +2024,7 @@ udf_fidsize(struct fileid_desc *fid)
if (udf_rw16(fid->tag.id) != TAGID_FID)
errx(1, "internal error, bad tag in %s", __func__);
- size = UDF_FID_SIZE + udf_rw16(fid->l_fi) + udf_rw16(fid->l_iu);
+ size = UDF_FID_SIZE + fid->l_fi + udf_rw16(fid->l_iu);
size = (size + 3) & ~3;
return size;