forked from pool/schily
9e7e1fa33b
OBS-URL: https://build.opensuse.org/request/show/591704 OBS-URL: https://build.opensuse.org/package/show/utilities/schily?expand=0&rev=1
88 lines
2.7 KiB
Diff
88 lines
2.7 KiB
Diff
From: Jan Engelhardt <jengelh@inai.de>
|
|
Date: 2013-11-14 02:36:58.866260522 +0100
|
|
References: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59125
|
|
|
|
build: workaround a gcc-4.8 bug
|
|
|
|
Add memset to clear the entire buffer beforehand. Then, use memcpy,
|
|
which is equally good given that the size of all strings is known.
|
|
|
|
---
|
|
cdrecord/scsi_cdr.c | 21 ++++++++++-----------
|
|
1 file changed, 10 insertions(+), 11 deletions(-)
|
|
|
|
Index: cdrtools-3.01/cdrecord/scsi_cdr.c
|
|
===================================================================
|
|
--- cdrtools-3.01.orig/cdrecord/scsi_cdr.c
|
|
+++ cdrtools-3.01/cdrecord/scsi_cdr.c
|
|
@@ -2282,14 +2282,13 @@ getdev(scgp, print)
|
|
printf("\n");
|
|
}
|
|
|
|
+ memset(vendor_info, '\0', sizeof(vendor_info));
|
|
+ memset(prod_ident, '\0', sizeof(prod_ident));
|
|
+ memset(prod_revision, '\0', sizeof(prod_revision));
|
|
strncpy(vendor_info, inq->inq_vendor_info, sizeof (inq->inq_vendor_info));
|
|
strncpy(prod_ident, inq->inq_prod_ident, sizeof (inq->inq_prod_ident));
|
|
strncpy(prod_revision, inq->inq_prod_revision, sizeof (inq->inq_prod_revision));
|
|
|
|
- vendor_info[sizeof (inq->inq_vendor_info)] = '\0';
|
|
- prod_ident[sizeof (inq->inq_prod_ident)] = '\0';
|
|
- prod_revision[sizeof (inq->inq_prod_revision)] = '\0';
|
|
-
|
|
switch (inq->type) {
|
|
|
|
case INQ_DASD:
|
|
@@ -2316,29 +2315,29 @@ getdev(scgp, print)
|
|
if (inq->add_len == 0) {
|
|
if (scgp->dev == DEV_UNKNOWN && got_inquiry) {
|
|
scgp->dev = DEV_ACB5500;
|
|
- strncpy(inq->inq_info_space,
|
|
+ memcpy(inq->inq_info_space,
|
|
"ADAPTEC ACB-5500 FAKE",
|
|
sizeof (inq->inq_info_space));
|
|
|
|
} else switch (scgp->dev) {
|
|
|
|
case DEV_ACB40X0:
|
|
- strncpy(inq->inq_info_space,
|
|
+ memcpy(inq->inq_info_space,
|
|
"ADAPTEC ACB-40X0 FAKE",
|
|
sizeof (inq->inq_info_space));
|
|
break;
|
|
case DEV_ACB4000:
|
|
- strncpy(inq->inq_info_space,
|
|
+ memcpy(inq->inq_info_space,
|
|
"ADAPTEC ACB-4000 FAKE",
|
|
sizeof (inq->inq_info_space));
|
|
break;
|
|
case DEV_ACB4010:
|
|
- strncpy(inq->inq_info_space,
|
|
+ memcpy(inq->inq_info_space,
|
|
"ADAPTEC ACB-4010 FAKE",
|
|
sizeof (inq->inq_info_space));
|
|
break;
|
|
case DEV_ACB4070:
|
|
- strncpy(inq->inq_info_space,
|
|
+ memcpy(inq->inq_info_space,
|
|
"ADAPTEC ACB-4070 FAKE",
|
|
sizeof (inq->inq_info_space));
|
|
break;
|
|
@@ -2370,14 +2369,14 @@ getdev(scgp, print)
|
|
|
|
case INQ_SEQD:
|
|
if (scgp->dev == DEV_SC4000) {
|
|
- strncpy(inq->inq_info_space,
|
|
+ memcpy(inq->inq_info_space,
|
|
"SYSGEN SC4000 FAKE",
|
|
sizeof (inq->inq_info_space));
|
|
} else if (inq->add_len == 0 &&
|
|
inq->removable &&
|
|
inq->ansi_version == 1) {
|
|
scgp->dev = DEV_MT02;
|
|
- strncpy(inq->inq_info_space,
|
|
+ memcpy(inq->inq_info_space,
|
|
"EMULEX MT02 FAKE",
|
|
sizeof (inq->inq_info_space));
|
|
}
|