diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2021-05-03 05:26:48 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2021-05-03 05:26:48 +0000 |
commit | b2d08c24d50a7b1ff3b30f6a5c34cb4e5a155326 (patch) | |
tree | a6ac3874718c32f5f075bc4b56d461909c42a4dc | |
parent | 1b551c7b147d0ed75a841e09d61d39cff1d57a4a (diff) | |
download | sg3_utils-b2d08c24d50a7b1ff3b30f6a5c34cb4e5a155326.tar.gz |
sg_ses: On Windows fix 'No command (cdb) given'
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@898 6180dd3e-e324-4e3e-922d-17de1ae2f315
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | lib/sg_pt_win32.c | 16 |
2 files changed, 15 insertions, 4 deletions
@@ -2,8 +2,9 @@ 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 [20210502] [svn: r897] +Changelog for pre-release sg3_utils-1.47 [20210503] [svn: r898] - sg_raw: fix prints of NVMe NVM command names + - sg_ses: fix Windows problem "No command (cdb) given" - sg_lib: add sg_scsi_status_is_good() - pt_linux: fix verify(BytChk=0) which Linux SNTL translated to write, other SNTL cleanups diff --git a/lib/sg_pt_win32.c b/lib/sg_pt_win32.c index cc56a26d..4ed4a0ad 100644 --- a/lib/sg_pt_win32.c +++ b/lib/sg_pt_win32.c @@ -929,7 +929,17 @@ get_scsi_pt_cdb_buf(const struct sg_pt_base * vp) { const struct sg_pt_win32_scsi * psp = vp->implp; - return (uint8_t *)(spt_direct ? psp->swb_d.spt.Cdb : psp->swb_i.spt.Cdb); + if (spt_direct) { + if (psp->swb_d.spt.CdbLength > 0) + return (uint8_t *)(psp->swb_d.spt.Cdb); + else + return NULL; + } else { + if (psp->swb_i.spt.CdbLength > 0) + return (uint8_t *)(psp->swb_i.spt.Cdb); + else + return NULL; + } } void @@ -1051,7 +1061,7 @@ scsi_pt_direct(struct sg_pt_win32_scsi * psp, struct sg_pt_handle * shp, psp->os_err = 0; if (0 == psp->swb_d.spt.CdbLength) { if (vb) - pr2ws("No command (cdb) given\n"); + pr2ws("%s: No command (cdb) given\n", __func__); return SCSI_PT_DO_BAD_PARAMS; } psp->swb_d.spt.Length = sizeof (SCSI_PASS_THROUGH_DIRECT); @@ -1127,7 +1137,7 @@ scsi_pt_indirect(struct sg_pt_base * vp, struct sg_pt_handle * shp, if (0 == psp->swb_i.spt.CdbLength) { if (vb) - pr2ws("No command (cdb) given\n"); + pr2ws("%s: No command (cdb) given\n", __func__); return SCSI_PT_DO_BAD_PARAMS; } if (psp->dxfer_len > (int)sizeof(psp->swb_i.ucDataBuf)) { |