diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2022-01-19 19:12:36 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2022-01-19 19:12:36 +0000 |
commit | 84c586f1f1d8bd102928f3ae95d1d1185a59de8f (patch) | |
tree | 4e078230ad1395e3524357e64abf506e35f5acb8 /lib/sg_cmds_basic.c | |
parent | 31de60f68ae11ed1ad16510e0e86b5603f93bda3 (diff) | |
download | sg3_utils-84c586f1f1d8bd102928f3ae95d1d1185a59de8f.tar.gz |
round of coverity identified issue fixes (and non-issues)
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@931 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'lib/sg_cmds_basic.c')
-rw-r--r-- | lib/sg_cmds_basic.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/lib/sg_cmds_basic.c b/lib/sg_cmds_basic.c index e1773542..92dd102d 100644 --- a/lib/sg_cmds_basic.c +++ b/lib/sg_cmds_basic.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2021 Douglas Gilbert. + * Copyright (c) 1999-2022 Douglas Gilbert. * All rights reserved. * Use of this source code is governed by a BSD-style * license that can be found in the BSD_LICENSE file. @@ -42,7 +42,7 @@ #endif -static const char * const version_str = "1.99 20210830"; +static const char * const version_str = "2.00 20220118"; #define SENSE_BUFF_LEN 64 /* Arbitrary, could be larger */ @@ -192,7 +192,6 @@ int sg_cmds_process_resp(struct sg_pt_base * ptvp, const char * leadin, int pt_res, bool noisy, int verbose, int * o_sense_cat) { - bool favour_sense; int cat, slen, sstat, req_din_x, req_dout_x; int act_din_x, act_dout_x; const uint8_t * sbp; @@ -323,19 +322,23 @@ sg_cmds_process_resp(struct sg_pt_base * ptvp, const char * leadin, get_scsi_pt_transport_err_str(ptvp, sizeof(b), b); pr2ws("%s: transport: %s\n", leadin, b); } - /* Shall we favour sense data over a transport error (given both) */ #ifdef SG_LIB_LINUX - favour_sense = false; /* DRIVER_SENSE is not passed through */ + return -1; /* DRIVER_SENSE is not passed through */ #else - favour_sense = ((SAM_STAT_CHECK_CONDITION == - get_scsi_pt_status_response(ptvp)) && (slen > 0)); + /* Shall we favour sense data over a transport error (given both) */ + { + bool favour_sense = ((SAM_STAT_CHECK_CONDITION == + get_scsi_pt_status_response(ptvp)) && (slen > 0)); + + if (favour_sense) + return sg_cmds_process_helper(leadin, req_din_x, act_din_x, + req_dout_x, act_dout_x, sbp, + slen, noisy, verbose, + o_sense_cat); + else + return -1; + } #endif - if (favour_sense) - return sg_cmds_process_helper(leadin, req_din_x, act_din_x, - req_dout_x, act_dout_x, sbp, slen, - noisy, verbose, o_sense_cat); - else - return -1; case SCSI_PT_RESULT_OS_ERR: if (verbose || noisy) { get_scsi_pt_os_err_str(ptvp, sizeof(b), b); |