Skip to content

Commit f81286d

Browse files
committed
makefs: Exit with error if writing cd image fails
Obtained from: OpenBSD c8f48d9b1ea9 Sponsored by: The FreeBSD Foundation (cherry picked from commit b45f84c) (cherry picked from commit afb7a85)
1 parent 79778b7 commit f81286d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

usr.sbin/makefs/cd9660.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ cd9660_makefs(const char *image, const char *dir, fsnode *root,
467467
fsinfo_t *fsopts)
468468
{
469469
int64_t startoffset;
470-
int numDirectories;
470+
int ret, numDirectories;
471471
uint64_t pathTableSectors;
472472
int64_t firstAvailableSector;
473473
int64_t totalSpace;
@@ -613,7 +613,7 @@ cd9660_makefs(const char *image, const char *dir, fsnode *root,
613613
if (diskStructure->include_padding_areas)
614614
diskStructure->totalSectors += 150;
615615

616-
cd9660_write_image(diskStructure, image);
616+
ret = cd9660_write_image(diskStructure, image);
617617

618618
if (diskStructure->verbose_level > 1) {
619619
debug_print_volume_descriptor_information(diskStructure);
@@ -625,7 +625,10 @@ cd9660_makefs(const char *image, const char *dir, fsnode *root,
625625
cd9660_free_structure(real_root);
626626

627627
if (diskStructure->verbose_level > 0)
628-
printf("%s: done\n", __func__);
628+
printf("%s: done ret = %d\n", __func__, ret);
629+
630+
if (ret == 0) /* cd9660_write_image() failed */
631+
exit(1);
629632
}
630633

631634
/* Generic function pointer - implement later */

0 commit comments

Comments
 (0)