diff options
author | YASUOKA Masahiko <yasuoka@cvs.openbsd.org> | 2018-11-20 01:13:16 +0000 |
---|---|---|
committer | YASUOKA Masahiko <yasuoka@cvs.openbsd.org> | 2018-11-20 01:13:16 +0000 |
commit | a9e2211fb3c82cacb244b704c1971bdf48a07336 (patch) | |
tree | 6ce70d61c8f19b3564b99ac360c70c66009a1160 /usr.sbin | |
parent | c23d6df5c75f7fc7b71a03a374dbada610ebb19b (diff) |
unveil(2) boot images which are specified by -o option. Also exit
with an error status when writing cd image fails.
ok deraadt
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/makefs/cd9660.c | 11 | ||||
-rw-r--r-- | usr.sbin/makefs/cd9660/cd9660_eltorito.c | 4 |
2 files changed, 11 insertions, 4 deletions
diff --git a/usr.sbin/makefs/cd9660.c b/usr.sbin/makefs/cd9660.c index 07aad8301ae..80e0f8dd3bf 100644 --- a/usr.sbin/makefs/cd9660.c +++ b/usr.sbin/makefs/cd9660.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd9660.c,v 1.20 2017/04/06 19:09:45 natano Exp $ */ +/* $OpenBSD: cd9660.c,v 1.21 2018/11/20 01:13:14 yasuoka Exp $ */ /* $NetBSD: cd9660.c,v 1.53 2016/11/25 23:02:44 christos Exp $ */ /* @@ -402,7 +402,7 @@ cd9660_makefs(const char *image, const char *dir, fsnode *root, fsinfo_t *fsopts) { int64_t startoffset; - int numDirectories; + int ret, numDirectories; uint64_t pathTableSectors; int64_t firstAvailableSector; int64_t totalSpace; @@ -514,10 +514,13 @@ cd9660_makefs(const char *image, const char *dir, fsnode *root, if (diskStructure->include_padding_areas) diskStructure->totalSectors += 150; - cd9660_write_image(diskStructure, image); + ret = cd9660_write_image(diskStructure, image); /* Clean up data structures */ cd9660_free_structure(real_root); + + if (ret == 0) /* cd9660_write_image() failed */ + exit(1); } /* Generic function pointer - implement later */ @@ -1971,6 +1974,8 @@ cd9660_add_generic_bootimage(iso9660_disk *diskStructure, const char *bootimage) diskStructure->generic_bootimage = estrdup(bootimage); + if (unveil(diskStructure->generic_bootimage, "r") == -1) + err(1, "unveil"); /* Get information about the file */ if (lstat(diskStructure->generic_bootimage, &stbuf) == -1) err(1, "%s: lstat(\"%s\")", __func__, diff --git a/usr.sbin/makefs/cd9660/cd9660_eltorito.c b/usr.sbin/makefs/cd9660/cd9660_eltorito.c index cec8a8e3664..1c9b291a8b1 100644 --- a/usr.sbin/makefs/cd9660/cd9660_eltorito.c +++ b/usr.sbin/makefs/cd9660/cd9660_eltorito.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd9660_eltorito.c,v 1.13 2017/11/07 00:22:40 yasuoka Exp $ */ +/* $OpenBSD: cd9660_eltorito.c,v 1.14 2018/11/20 01:13:15 yasuoka Exp $ */ /* $NetBSD: cd9660_eltorito.c,v 1.20 2013/01/28 21:03:28 christos Exp $ */ /* @@ -119,6 +119,8 @@ cd9660_add_boot_disk(iso9660_disk *diskStructure, const char *boot_info) free(temp); + if (unveil(new_image->filename, "r") == -1) + err(1, "unveil"); /* Get information about the file */ if (lstat(new_image->filename, &stbuf) == -1) err(1, "%s: lstat(\"%s\")", __func__, new_image->filename); |