summaryrefslogtreecommitdiff
path: root/usr/src/cmd/cdrw/bstream.c
diff options
context:
space:
mode:
authorMarcel Telka <marcel@telka.sk>2012-12-04 14:37:13 -0500
committerRichard Lowe <richlowe@richlowe.net>2012-12-04 17:44:46 -0500
commiteab441e29d159ff1e25d3af8cd61798e641989b2 (patch)
treec166d06a57cd20511dbc8b44ce94a515d38ef659 /usr/src/cmd/cdrw/bstream.c
parente690fb27a7d1483f052505e1ff373d205f9dee99 (diff)
downloadillumos-joyent-eab441e29d159ff1e25d3af8cd61798e641989b2.tar.gz
3378 cdrw is unable to write some ISO images
Reviewed by: Gary Mills <gary_mills@fastmail.fm> Reviewed by: Milan Jurik <milan.jurik@xylab.cz> Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src/cmd/cdrw/bstream.c')
-rw-r--r--usr/src/cmd/cdrw/bstream.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/usr/src/cmd/cdrw/bstream.c b/usr/src/cmd/cdrw/bstream.c
index 77cc3db53c..a9c5639952 100644
--- a/usr/src/cmd/cdrw/bstream.c
+++ b/usr/src/cmd/cdrw/bstream.c
@@ -22,8 +22,9 @@
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright 2012 Marcel Telka <marcel@telka.sk>
+ */
#include <fcntl.h>
#include <string.h>
@@ -297,42 +298,44 @@ open_iso_read_stream(char *fname)
return (NULL);
if (debug)
- (void) printf("Checking the ISO 9660 file header\n");
+ (void) printf("Checking the ISO file header\n");
/* Check to see if we have a valid sized ISO image */
h->bstr_size(h, &iso_size);
if (iso_size < ISO9660_HEADER_SIZE) {
if (debug)
- (void) printf("ISO 9660 header size not sane.\n");
+ (void) printf("ISO header size not sane.\n");
h->bstr_close(h);
str_errno = STR_ERR_ISO_BAD_HEADER;
return (NULL);
}
if (debug)
- (void) printf("ISO 9660 header size is sane.\n");
+ (void) printf("ISO header size is sane.\n");
/* Skip over the boot block sector of the ISO. */
(void) lseek(h->bstr_fd, ISO9660_BOOT_BLOCK_SIZE, SEEK_SET);
/*
* Try to read in the ISO Descriptor and validate this
- * is in fact an ISO 9660 image.
+ * is in fact an ISO image.
*/
if (read(h->bstr_fd, iso_desc, ISO9660_PRIMARY_DESC_SIZE) ==
ISO9660_PRIMARY_DESC_SIZE) {
/*
- * Bytes one through five of a valid ISO 9660 cd image
- * should contain the string CD001. High Sierra format,
- * the ISO 9660 predecessor, fills this field with the
- * string CDROM. If neither is the case then we should
- * close the stream, set str_errno, and return NULL.
+ * Bytes one through five of a valid image should contain:
+ * - BEA01 (ISO 13490 image)
+ * - CD001 (ISO 9660 or ISO 13490 image)
+ * - CDROM (High Sierra format, the ISO 9660 predecessor)
+ * If neither is the case then we should close the stream,
+ * set str_errno, and return NULL.
*/
- if (strncmp(iso_desc + ISO9660_STD_IDENT_OFFSET, "CD001",
+ if (strncmp(iso_desc + ISO9660_STD_IDENT_OFFSET, "BEA01",
5) != 0 && strncmp(iso_desc + ISO9660_STD_IDENT_OFFSET,
- "CDROM", 5) != 0) {
+ "CD001", 5) != 0 && strncmp(iso_desc +
+ ISO9660_STD_IDENT_OFFSET, "CDROM", 5) != 0) {
if (debug)
- (void) printf("Invalid ISO 9660 identifier.\n");
+ (void) printf("Invalid ISO identifier.\n");
h->bstr_close(h);
str_errno = STR_ERR_ISO_BAD_HEADER;
return (NULL);
@@ -348,7 +351,7 @@ open_iso_read_stream(char *fname)
* and return the handle.
*/
if (debug)
- (void) printf("ISO 9660 header is sane.\n");
+ (void) printf("ISO header is sane.\n");
h->bstr_rewind(h);
return (h);
}
@@ -488,7 +491,7 @@ open_wav_read_stream(char *fname)
goto wav_open_failed;
}
if ((strncmp(wav->riff, "RIFF", 4) != 0) ||
- (strncmp(wav->wave, "WAVE", 4) != 0)) {
+ (strncmp(wav->wave, "WAVE", 4) != 0)) {
str_errno = STR_ERR_WAV_BAD_HEADER;
goto wav_open_failed;
}