From c1ce6d6c5f3f64038e17dfd65380aa728c5d994d Mon Sep 17 00:00:00 2001 From: Douglas Gilbert Date: Fri, 1 Oct 2021 16:24:37 +0000 Subject: [PATCH] sg_requests: fix bug in output git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@915 6180dd3e-e324-4e3e-922d-17de1ae2f315 --- ChangeLog | 2 +- debian/changelog | 2 +- doc/sg3_utils.8 | 2 +- sg3_utils.spec | 2 +- src/sg_decode_sense.c | 13 +++++++------ src/sg_requests.c | 4 ++-- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9cea8a15..d581db85 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,7 +2,7 @@ Each utility has its own version number, date of last change and some description at the top of its ".c" file. All utilities in the main directory have their own "man" pages. There is also a sg3_utils man page. -Changelog for pre-release sg3_utils-1.47 [20210924] [svn: r914] +Changelog for pre-release sg3_utils-1.47 [20211001] [svn: r915] - transport error handling improved. To fix report of a BAD_TARGET transport error but the utility still continued. - introduce SG_LIB_TRANSPORT_ERROR [35] exit status diff --git a/debian/changelog b/debian/changelog index 2ff6baad..60dc3a8f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,7 +2,7 @@ sg3-utils (1.47-0.1) unstable; urgency=low * New upstream version - -- Douglas Gilbert Sat, 25 Sep 2021 00:01:00 -0400 + -- Douglas Gilbert Fri, 01 Oct 2021 12:00:00 -0400 sg3-utils (1.46-0.1) unstable; urgency=low diff --git a/doc/sg3_utils.8 b/doc/sg3_utils.8 index d4ff0456..d57f33cc 100644 --- a/doc/sg3_utils.8 +++ b/doc/sg3_utils.8 @@ -1,4 +1,4 @@ -.TH SG3_UTILS "8" "August 2021" "sg3_utils\-1.47" SG3_UTILS +.TH SG3_UTILS "8" "October 2021" "sg3_utils\-1.47" SG3_UTILS .SH NAME sg3_utils \- a package of utilities for sending SCSI commands .SH SYNOPSIS diff --git a/sg3_utils.spec b/sg3_utils.spec index 35b4b35b..3cce953b 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -84,7 +84,7 @@ fi %{_libdir}/*.la %changelog -* Sat Sep 25 2021 - dgilbert at interlog dot com +* Fri Oct 01 2021 - dgilbert at interlog dot com - track t10 changes * sg3_utils-1.47 diff --git a/src/sg_decode_sense.c b/src/sg_decode_sense.c index 18b4ef6e..e3db2094 100644 --- a/src/sg_decode_sense.c +++ b/src/sg_decode_sense.c @@ -30,7 +30,7 @@ #include "sg_unaligned.h" -static const char * version_str = "1.22 20210610"; +static const char * version_str = "1.23 20211001"; #define MAX_SENSE_LEN 1024 /* max descriptor format actually: 255+8 */ @@ -282,7 +282,7 @@ write2wfn(FILE * fp, struct opts_t * op) int main(int argc, char *argv[]) { - int k, err; + int k, err, blen; int ret = 0; unsigned int ui; size_t s; @@ -293,8 +293,9 @@ main(int argc, char *argv[]) struct opts_t opts; op = &opts; + blen = sizeof(b); memset(op, 0, sizeof(opts)); - memset(b, 0, sizeof(b)); + memset(b, 0, blen); ret = parse_cmd_line(op, argc, argv); #ifdef DEBUG @@ -339,7 +340,7 @@ main(int argc, char *argv[]) } if (op->do_status) { - sg_get_scsi_status_str(op->sstatus, sizeof(b) - 1, b); + sg_get_scsi_status_str(op->sstatus, blen, b); printf("SCSI status: %s\n", b); } @@ -421,10 +422,10 @@ main(int argc, char *argv[]) sa = op->sense[1] & 0x1f; else sa = 0; - sg_get_opcode_sa_name(opcode, sa, 0, sizeof(b), b); + sg_get_opcode_sa_name(opcode, sa, 0, blen, b); } else sg_get_sense_str(NULL, op->sense, op->sense_len, - op->verbose, sizeof(b) - 1, b); + op->verbose, blen, b); printf("%s\n", b); } fini: diff --git a/src/sg_requests.c b/src/sg_requests.c index 99e42dd9..a0afd365 100644 --- a/src/sg_requests.c +++ b/src/sg_requests.c @@ -34,7 +34,7 @@ * This program issues the SCSI command REQUEST SENSE to the given SCSI device. */ -static const char * version_str = "1.37 20210830"; +static const char * version_str = "1.38 20211001"; #define MAX_REQS_RESP_LEN 255 #define DEF_REQS_RESP_LEN 252 @@ -478,7 +478,7 @@ main(int argc, char * argv[]) sg_get_sense_str(NULL, rsBuff, act_din_len, false, sizeof(bb), bb); - pr2serr("data-in decoded as sense:\n%s\n", b); + pr2serr("data-in decoded as sense:\n%s\n", bb); } } }